Class: Crisp::Nodes::Block
- Defined in:
- lib/crisp/nodes/block.rb
Overview
The block node
Instance Method Summary collapse
-
#eval(env) ⇒ Object
eval each element of the block and return the last result.
-
#resolve(env) ⇒ Object
a block resolves to itself.
Methods inherited from Base
Instance Method Details
#eval(env) ⇒ Object
eval each element of the block and return the last result
6 7 8 9 10 11 12 13 14 |
# File 'lib/crisp/nodes/block.rb', line 6 def eval(env) last_result = nil elements.each do |op| last_result = op.resolve_and_eval(env) end last_result end |
#resolve(env) ⇒ Object
a block resolves to itself
17 18 19 |
# File 'lib/crisp/nodes/block.rb', line 17 def resolve(env) self end |