Class: Eqn::Terminal::Variable

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/eqn/terminal.rb

Instance Method Summary collapse

Instance Method Details

#valueObject



4
5
6
7
8
9
# File 'lib/eqn/terminal.rb', line 4

def value
  val = Eqn::Calculator.class_variable_get(:@@vars)[text_value.intern]
  raise NoVariableValueError, "No value given for: #{text_value}" unless val
  raise NonNumericVariableError, "Variable #{text_value} value is nonnumeric: #{val}" unless val.is_a? Numeric
  val
end