Class: Tilt::LiquidTemplate
Instance Attribute Summary
Attributes inherited from Template
#compiled_path, #data, #file, #line, #options
Instance Method Summary collapse
Methods inherited from Template
#basename, #compiled_method, default_mime_type, default_mime_type=, #eval_file, #fixed_locals?, #initialize, #metadata, metadata, #name, #render
Constructor Details
This class inherits a constructor from Tilt::Template
Instance Method Details
#allows_script? ⇒ Boolean
89 90 91 |
# File 'lib/tilt/liquid.rb', line 89 def allows_script? false end |
#evaluate(scope, locs) ⇒ Object
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/tilt/liquid.rb', line 78 def evaluate(scope, locs) locals = {} if scope.respond_to?(:to_h) scope.to_h.each{|k, v| locals[k.to_s] = v} end locs.each{|k, v| locals[k.to_s] = v} locals['yield'] = block_given? ? yield : '' locals['content'] = locals['yield'] @engine.render(locals) end |
#prepare ⇒ Object
73 74 75 76 |
# File 'lib/tilt/liquid.rb', line 73 def prepare [:line_numbers] = true unless .has_key?(:line_numbers) @engine = ::Liquid::Template.parse(@data, ) end |