Class: Crisp::Nodes::Block

Inherits:
Base
  • Object
show all
Defined in:
lib/crisp/nodes/block.rb

Overview

The block node

Instance Method Summary collapse

Methods inherited from Base

#resolve_and_eval

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