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 497
497:     def evaluate(scope, locals, &block)
498:       if @engine.respond_to?(:precompiled_method_return_value, true)
499:         super
500:       else
501:         @engine.render(scope, locals, &block)
502:       end
503:     end

[Source]

     # File lib/tilt.rb, line 487
487:     def initialize_engine
488:       return if defined? ::Haml::Engine
489:       require_template_library 'haml'
490:     end

[Source]

     # File lib/tilt.rb, line 528
528:     def precompiled_postamble(locals)
529:       @engine.instance_eval do
530:         "\#{precompiled_method_return_value}\nensure\n@haml_buffer = @haml_buffer.upper\nend\n"
531:       end
532:     end

[Source]

     # File lib/tilt.rb, line 512
512:     def precompiled_preamble(locals)
513:       local_assigns = super
514:       @engine.instance_eval do
515:         "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"
516:       end
517:     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 508
508:     def precompiled_template(locals)
509:       @engine.precompiled
510:     end

[Source]

     # File lib/tilt.rb, line 492
492:     def prepare
493:       options = @options.merge(:filename => eval_file, :line => line)
494:       @engine = ::Haml::Engine.new(data, options)
495:     end

[Validate]