Class: Plasma::Interpreter::TemplateNode
- Inherits:
-
PlasmaNode
- Object
- Treetop::Runtime::SyntaxNode
- PlasmaNode
- Plasma::Interpreter::TemplateNode
- Defined in:
- lib/plasma/interpreter/plasma_grammarnode.rb
Instance Method Summary collapse
Methods inherited from PlasmaNode
Instance Method Details
#evaluate(env) ⇒ Object
196 197 198 199 200 201 202 203 204 |
# File 'lib/plasma/interpreter/plasma_grammarnode.rb', line 196 def evaluate(env) value = body.empty? ? '' : body.elements.inject('') do |so_far, el| macro_value = el.macro.is_a?(ExpansionNode) ? el.macro.evaluate(env).to_s : el.macro.template.text_value tail_value = el.respond_to?(:tail) ? el.tail.text_value : '' so_far + macro_value + tail_value end head.text_value + value end |