class Tilt::HamlTemplate

Haml template implementation. See: haml.hamptoncatlin.com/

Public Instance Methods

evaluate(scope, locals, &block) click to toggle source
Calls superclass method Template#evaluate
   # File lib/tilt/haml.rb
22 def evaluate(scope, locals, &block)
23   raise ArgumentError, 'invalid scope: must not be frozen' if scope.frozen?
24   super
25 end
precompiled_postamble(locals) click to toggle source
   # File lib/tilt/haml.rb
74       def precompiled_postamble(locals)
75         @engine.instance_eval do
76           <<-RUBY
77               #{precompiled_method_return_value}
78             ensure
79               @haml_buffer = @haml_buffer.upper if haml_buffer
80             end
81           RUBY
82         end
83       end
precompiled_preamble(locals) click to toggle source
Calls superclass method Template#precompiled_preamble
   # File lib/tilt/haml.rb
59       def precompiled_preamble(locals)
60         local_assigns = super
61         @engine.instance_eval do
62           <<-RUBY
63             begin
64               extend Haml::Helpers
65               _hamlout = @haml_buffer = Haml::Buffer.new(haml_buffer, #{options_for_buffer.inspect})
66               _erbout = _hamlout.buffer
67               __in_erb_template = true
68               _haml_locals = locals
69               #{local_assigns}
70           RUBY
71         end
72       end
precompiled_template(locals) click to toggle source
   # File lib/tilt/haml.rb
27       def precompiled_template(locals)
28         @engine.precompiled_with_ambles(
29           [],
30           after_preamble: <<-RUBY
31             __in_erb_template = true
32             _haml_locals = locals
33           RUBY
34         )
35       end
prepare() click to toggle source
   # File lib/tilt/haml.rb
12 def prepare
13   options = {}.update(@options).update(filename: eval_file, line: line)
14   if options.include?(:outvar)
15     options[:buffer] = options.delete(:outvar)
16     options[:save_buffer] = true
17   end
18   @engine = ::Haml::TempleEngine.new(options)
19   @engine.compile(data)
20 end