Class: Confuscript::Nodes::ProgramNode
- Inherits:
-
BaseNode
- Object
- Treetop::Runtime::SyntaxNode
- BaseNode
- Confuscript::Nodes::ProgramNode
- Defined in:
- lib/confuscript/nodes/program_node.rb
Instance Method Summary collapse
Methods inherited from BaseNode
Instance Method Details
#children ⇒ Object
11 12 13 |
# File 'lib/confuscript/nodes/program_node.rb', line 11 def children elements[1]&.elements || [] end |
#evaluate(context) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/confuscript/nodes/program_node.rb', line 4 def evaluate(context) # Not the best way to evaluate # TODO:- Revisit this # Evaluate all children and return the result of the last one children.map { |child| child.elements[0].evaluate(context) }.last end |
#first_child ⇒ Object
15 16 17 |
# File 'lib/confuscript/nodes/program_node.rb', line 15 def first_child children.first&.elements&.first end |