Class: Tilt::HamlTemplate
Overview
Instance Attribute Summary
Attributes inherited from Template
#data, #file, #line, #options
Instance Method Summary
collapse
Methods inherited from Template
#basename, #eval_file, #initialize, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
461
462
463
464
465
466
467
|
# File 'lib/frank/tilt.rb', line 461
def evaluate(scope, locals, &block)
if @engine.respond_to?(:precompiled_method_return_value, true)
super
else
@engine.render(scope, locals, &block)
end
end
|
#initialize_engine ⇒ Object
451
452
453
454
|
# File 'lib/frank/tilt.rb', line 451
def initialize_engine
return if defined? ::Haml::Engine
require_template_library 'haml'
end
|
#precompiled_postamble(locals) ⇒ Object
491
492
493
494
495
496
497
498
499
500
|
# File 'lib/frank/tilt.rb', line 491
def precompiled_postamble(locals)
@engine.instance_eval do
<<-RUBY
#{precompiled_method_return_value}
ensure
@haml_buffer = @haml_buffer.upper
end
RUBY
end
end
|
#precompiled_preamble(locals) ⇒ Object
476
477
478
479
480
481
482
483
484
485
486
487
488
489
|
# File 'lib/frank/tilt.rb', line 476
def precompiled_preamble(locals)
local_assigns = super
@engine.instance_eval do
<<-RUBY
begin
extend Haml::Helpers
_hamlout = @haml_buffer = Haml::Buffer.new(@haml_buffer, #{options_for_buffer.inspect})
_erbout = _hamlout.buffer
__in_erb_template = true
_haml_locals = locals
#{local_assigns}
RUBY
end
end
|
#precompiled_template(locals) ⇒ Object
472
473
474
|
# File 'lib/frank/tilt.rb', line 472
def precompiled_template(locals)
@engine.precompiled
end
|
#prepare ⇒ Object
456
457
458
459
|
# File 'lib/frank/tilt.rb', line 456
def prepare
options = @options.merge(:filename => eval_file, :line => line)
@engine = ::Haml::Engine.new(data, options)
end
|