| Module | Sinatra::Haml::EventContext |
| In: |
vendor/haml/lib/haml.rb
|
Renders Haml within an event.
Inline example:
get '/foo' do
haml '== The time is #{Time.now}'
end
Template example:
get '/foo' do
haml :foo #=> reads and renders view/foo.haml
end
For options, see Sinatra::Renderer
See also: Sinatra::Renderer
# File vendor/haml/lib/haml.rb, line 34
34: def haml(template, options = {}, &layout)
35: render(template, :haml, options, &layout)
36: end
Renders raw haml in within the events context.
This can be use to if you already have the template on hand and don‘t need a layout. This is speedier than using haml
# File vendor/haml/lib/haml.rb, line 12
12: def render_haml(template)
13: require 'haml'
14: body ::Haml::Engine.new(template).render(self)
15: end