Class: Code::Node::Decimal
- Inherits:
-
Code::Node
- Object
- Code::Node
- Code::Node::Decimal
- Defined in:
- lib/code/node/decimal.rb
Instance Method Summary collapse
- #evaluate(**args) ⇒ Object
-
#initialize(parsed) ⇒ Decimal
constructor
A new instance of Decimal.
Constructor Details
#initialize(parsed) ⇒ Decimal
Returns a new instance of Decimal.
4 5 6 7 8 9 10 11 12 |
# File 'lib/code/node/decimal.rb', line 4 def initialize(parsed) @decimal = parsed.delete(:decimal) if parsed.key?(:exponent) @exponent = Node::Statement.new(parsed.delete(:exponent)) end super(parsed) end |
Instance Method Details
#evaluate(**args) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/code/node/decimal.rb', line 14 def evaluate(**args) if @exponent ::Code::Object::Decimal.new( @decimal, exponent: @exponent.evaluate(**args) ) else ::Code::Object::Decimal.new(@decimal) end end |