Class: Code::Node::Base10
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::Base10
- Defined in:
- lib/code/node/base_10.rb
Instance Method Summary collapse
- #evaluate(**args) ⇒ Object
-
#initialize(parsed) ⇒ Base10
constructor
A new instance of Base10.
Constructor Details
Instance Method Details
#evaluate(**args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/code/node/base_10.rb', line 14 def evaluate(**args) if @exponent exponent = @exponent.evaluate(**args) if exponent.is_a?(::Code::Object::Integer) ::Code::Object::Integer.new(@whole.to_i, exponent: exponent) else ::Code::Object::Decimal.new(@whole, exponent: exponent) end else ::Code::Object::Integer.new(@whole.to_i) end end |