Class | Tilt::HamlTemplate |
In: |
lib/tilt.rb
|
Parent: | Template |
Haml template implementation. See: haml.hamptoncatlin.com/
# File lib/tilt.rb, line 491 491: def evaluate(scope, locals, &block) 492: if @engine.respond_to?(:precompiled_method_return_value, true) 493: super 494: else 495: @engine.render(scope, locals, &block) 496: end 497: end
# File lib/tilt.rb, line 481 481: def initialize_engine 482: return if defined? ::Haml::Engine 483: require_template_library 'haml' 484: end
# File lib/tilt.rb, line 522 522: def precompiled_postamble(locals) 523: @engine.instance_eval do 524: "\#{precompiled_method_return_value}\nensure\n@haml_buffer = @haml_buffer.upper\nend\n" 525: end 526: end
# File lib/tilt.rb, line 506 506: def precompiled_preamble(locals) 507: local_assigns = super 508: @engine.instance_eval do 509: "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" 510: end 511: 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.rb, line 502 502: def precompiled_template(locals) 503: @engine.precompiled 504: end