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
# File 'lib/crisp/nodes/block.rb', line 6

def eval(env)
  elements.map do |op|
    op.resolve_and_eval(env)
  end.last
end

#resolve(env) ⇒ Object

a block resolves to itself



13
14
15
# File 'lib/crisp/nodes/block.rb', line 13

def resolve(env)
  self
end