Class Tilt::HamlTemplate
In: lib/tilt.rb
Parent: Template

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

Methods

Public Instance methods

[Source]

     # File lib/tilt.rb, line 487
487:     def evaluate(scope, locals, &block)
488:       if @engine.respond_to?(:precompiled_method_return_value, true)
489:         super
490:       else
491:         @engine.render(scope, locals, &block)
492:       end
493:     end

[Source]

     # File lib/tilt.rb, line 477
477:     def initialize_engine
478:       return if defined? ::Haml::Engine
479:       require_template_library 'haml'
480:     end

[Source]

     # File lib/tilt.rb, line 518
518:     def precompiled_postamble(locals)
519:       @engine.instance_eval do
520:         "\#{precompiled_method_return_value}\nensure\n@haml_buffer = @haml_buffer.upper\nend\n"
521:       end
522:     end

[Source]

     # File lib/tilt.rb, line 502
502:     def precompiled_preamble(locals)
503:       local_assigns = super
504:       @engine.instance_eval do
505:         "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"
506:       end
507:     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

[Source]

     # File lib/tilt.rb, line 498
498:     def precompiled_template(locals)
499:       @engine.precompiled
500:     end

[Source]

     # File lib/tilt.rb, line 482
482:     def prepare
483:       options = @options.merge(:filename => eval_file, :line => line)
484:       @engine = ::Haml::Engine.new(data, options)
485:     end

[Validate]