Class: Gloo::Expr::LInteger
- Inherits:
-
Core::Literal
- Object
- Core::Literal
- Gloo::Expr::LInteger
- Defined in:
- lib/gloo/expr/l_integer.rb
Instance Attribute Summary
Attributes inherited from Core::Literal
Class Method Summary collapse
-
.integer?(token) ⇒ Boolean
Is the given token an integer?.
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
.integer?(token) ⇒ Boolean
Is the given token an integer?
14 15 16 17 18 19 |
# File 'lib/gloo/expr/l_integer.rb', line 14 def self.integer?( token ) return true if token.is_a? Integer s = token.strip return s.to_i.to_s == s end |
Instance Method Details
#set_value(value) ⇒ Object
Set the value, converting to an integer.
24 25 26 |
# File 'lib/gloo/expr/l_integer.rb', line 24 def set_value( value ) @value = value.to_i end |
#to_s ⇒ Object
Get string representation
31 32 33 |
# File 'lib/gloo/expr/l_integer.rb', line 31 def to_s return self.value.to_s end |