Class: PersonifyLanguage::Expressions

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/personify/parser/personify_node_classes.rb

Instance Method Summary collapse

Instance Method Details

#eval(env) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/personify/parser/personify_node_classes.rb', line 27

def eval(env)
  last_value = nil
  expressions.detect do |exp|
    last_value = exp.eval(env)
  end
  last_value
end

#expressionsObject



35
36
37
# File 'lib/personify/parser/personify_node_classes.rb', line 35

def expressions
  [expression] + alternatives.elements.map {|elt| elt.expression_or_string}
end