Class: Eqn::Number::SignedNumber
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- Eqn::Number::SignedNumber
- Defined in:
- lib/eqn/number.rb
Instance Method Summary collapse
Instance Method Details
#value ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/eqn/number.rb', line 11 def value # Store sign if any. sign_negative = elements.shift.negative? if elements.first.is_a? Terminal::Sign # Evaluate float. value = elements.shift.value # Apply sign if any. sign_negative ? -value : value end |