Class: Nodes
- Inherits:
-
Struct
- Object
- Struct
- Nodes
- Defined in:
- lib/turmali/nodes.rb,
lib/turmali/interpreter.rb
Instance Attribute Summary collapse
-
#nodes ⇒ Object
Returns the value of attribute nodes.
Instance Method Summary collapse
-
#<<(node) ⇒ Object
Useful method for adding a node on the fly.
- #eval(context) ⇒ Object
Instance Attribute Details
#nodes ⇒ Object
Returns the value of attribute nodes
1 2 3 |
# File 'lib/turmali/nodes.rb', line 1 def nodes @nodes end |
Instance Method Details
#<<(node) ⇒ Object
Useful method for adding a node on the fly.
2 3 4 5 |
# File 'lib/turmali/nodes.rb', line 2 def <<(node) # Useful method for adding a node on the fly. nodes << node self end |
#eval(context) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/turmali/interpreter.rb', line 19 def eval(context) return_value = nil nodes.each do |node| return_value = node.eval(context) end return_value || Constants["nil"] end |