lib/gloo/expr/l_integer.rb in gloo-0.3.0 vs lib/gloo/expr/l_integer.rb in gloo-0.4.0
- old
+ new
@@ -5,19 +5,20 @@
#
module Gloo
module Expr
class LInteger < Gloo::Core::Literal
-
+
# Is the given token an integer?
- def self.is_integer? token
+ def self.integer?( token )
return true if token.is_a? Integer
+
s = token.strip
return s.to_i.to_s == s
end
-
+
# Set the value, converting to an integer.
- def set_value value
+ def set_value( value )
@value = value.to_i
end
def to_s
return self.value.to_s