Class: Gloo::Expr::LInteger

Inherits:
Core::Literal show all
Defined in:
lib/gloo/expr/l_integer.rb

Instance Attribute Summary

Attributes inherited from Core::Literal

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Literal

#initialize

Constructor Details

This class inherits a constructor from Gloo::Core::Literal

Class Method Details

.integer?(token) ⇒ Boolean

Is the given token an integer?

Returns:

  • (Boolean)


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_sObject

Get string representation



31
32
33
# File 'lib/gloo/expr/l_integer.rb', line 31

def to_s
  return self.value.to_s
end