Class: Gloo::Expr::LDecimal
- Inherits:
-
Core::Literal
- Object
- Core::Literal
- Gloo::Expr::LDecimal
- Defined in:
- lib/gloo/expr/l_decimal.rb
Instance Attribute Summary
Attributes inherited from Core::Literal
Class Method Summary collapse
-
.decimal?(token) ⇒ Boolean
Is the given token a decimal?.
Instance Method Summary collapse
-
#set_value(value) ⇒ Object
Set the value, converting to an integer.
-
#to_s ⇒ Object
Get string representation.
Methods inherited from Core::Literal
Constructor Details
This class inherits a constructor from Gloo::Core::Literal
Class Method Details
.decimal?(token) ⇒ Boolean
Is the given token a decimal?
14 15 16 17 18 19 |
# File 'lib/gloo/expr/l_decimal.rb', line 14 def self.decimal?( token ) return true if token.is_a? Numeric s = token.strip return s.to_f.to_s == s end |
Instance Method Details
#set_value(value) ⇒ Object
Set the value, converting to an integer.
24 25 26 27 28 |
# File 'lib/gloo/expr/l_decimal.rb', line 24 def set_value( value ) value = value.to_s if value.is_a? Numeric @value = value.to_f end |
#to_s ⇒ Object
Get string representation
33 34 35 |
# File 'lib/gloo/expr/l_decimal.rb', line 33 def to_s return self.value.to_s end |