1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Using Haml with Sinatra

By

6 of 7

A Quick Haml Tutorial

Finally, you can prepend any text with the equals sign to execute Ruby code. The return value of this Ruby code will be inserted into the output stream. This is similar to the Ruby exec tag in erb.

%p
  The time is now
  = Time.now

In addition, you can refer to both local and member variables in both the Ruby exec elements and as HTML attributes.

For more information on Haml, you can refer to the Haml homepage and documentation.

  1. About.com
  2. Technology
  3. Ruby
  4. Tutorials
  5. Sinatra
  6. A Quick Haml Tutorial

©2014 About.com. All rights reserved.