Class: Optimus::ParsedCalculator::NumberLiteral
- Defined in:
- lib/expression_parser/expressions.rb
Constant Summary
Constants inherited from Expr
Instance Method Summary collapse
- #evaluate(*args) ⇒ Object
-
#initialize(token) ⇒ NumberLiteral
constructor
A new instance of NumberLiteral.
- #to_s ⇒ Object
Methods inherited from Expr
#-@, #eq, #logical_and, #logical_not, #logical_or, #neq, #to_bool
Constructor Details
#initialize(token) ⇒ NumberLiteral
Returns a new instance of NumberLiteral.
103 104 105 |
# File 'lib/expression_parser/expressions.rb', line 103 def initialize(token) @token = token end |
Instance Method Details
#evaluate(*args) ⇒ Object
111 112 113 |
# File 'lib/expression_parser/expressions.rb', line 111 def evaluate(*args) @token.to_f end |
#to_s ⇒ Object
107 108 109 |
# File 'lib/expression_parser/expressions.rb', line 107 def to_s @token end |