Class: SimpleLogic::Variable

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/simple_logic/syntax_nodes.rb

Instance Method Summary collapse

Instance Method Details

#eval(context) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/simple_logic/syntax_nodes.rb', line 61

def eval(context)
  key = text_value.to_sym
  if context.include?(key)
    context[key]
  else
    raise UndefinedVariableError, "Undefined variable: \"#{text_value}\""
  end
end