Class: Query::Node::Decimal
- Inherits:
-
Query::Node
- Object
- Query::Node
- Query::Node::Decimal
- Defined in:
- lib/query/node/decimal.rb
Instance Attribute Summary collapse
-
#decimal ⇒ Object
Returns the value of attribute decimal.
-
#exponent ⇒ Object
Returns the value of attribute exponent.
Instance Method Summary collapse
- #evaluate(**args) ⇒ Object
-
#initialize(parsed) ⇒ Decimal
constructor
A new instance of Decimal.
Constructor Details
Instance Attribute Details
#decimal ⇒ Object
Returns the value of attribute decimal.
6 7 8 |
# File 'lib/query/node/decimal.rb', line 6 def decimal @decimal end |
#exponent ⇒ Object
Returns the value of attribute exponent.
6 7 8 |
# File 'lib/query/node/decimal.rb', line 6 def exponent @exponent end |
Instance Method Details
#evaluate(**args) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/query/node/decimal.rb', line 16 def evaluate(**args) if exponent BigDecimal(decimal) * 10**exponent.evaluate(**args) else BigDecimal(decimal) end end |