Class | Tilt::HamlTemplate |
In: |
lib/tilt/haml.rb
|
Parent: | Template |
Haml template implementation. See: haml.hamptoncatlin.com/
# File lib/tilt/haml.rb, line 22 22: def evaluate(scope, locals, &block) 23: if @engine.respond_to?(:precompiled_method_return_value, true) 24: super 25: else 26: @engine.render(scope, locals, &block) 27: end 28: end
# File lib/tilt/haml.rb, line 13 13: def initialize_engine 14: require_template_library 'haml' 15: end
# File lib/tilt/haml.rb, line 53 53: def precompiled_postamble(locals) 54: @engine.instance_eval do 55: "\#{precompiled_method_return_value}\nensure\n@haml_buffer = @haml_buffer.upper\nend\n" 56: end 57: end
# File lib/tilt/haml.rb, line 37 37: def precompiled_preamble(locals) 38: local_assigns = super 39: @engine.instance_eval do 40: "begin\nextend Haml::Helpers\n_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, \#{options_for_buffer.inspect})\n_erbout = _hamlout.buffer\n__in_erb_template = true\n_haml_locals = locals\n\#{local_assigns}\n" 41: end 42: end
Precompiled Haml source. Taken from the precompiled_with_ambles method in Haml::Precompiler: github.com/nex3/haml/blob/master/lib/haml/precompiler.rb#L111-126
# File lib/tilt/haml.rb, line 33 33: def precompiled_template(locals) 34: @engine.precompiled 35: end