Sha256: 3629bf4608fc1085a4afe13ee09f46fb043b8c49f8c6f725cec40de4e653f3c9

Contents?: true

Size: 608 Bytes

Versions: 8

Compression:

Stored size: 608 Bytes

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2019 Eric Crane.  All rights reserved.
#
# An Expression that can be evaluated.
#

module Gloo
  module Expr
    class LInteger < Gloo::Core::Literal

      # Is the given token an integer?
      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 )
        @value = value.to_i
      end

      def to_s
        return self.value.to_s
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gloo-0.6.1 lib/gloo/expr/l_integer.rb
gloo-0.6.0 lib/gloo/expr/l_integer.rb
gloo-0.5.4 lib/gloo/expr/l_integer.rb
gloo-0.5.3 lib/gloo/expr/l_integer.rb
gloo-0.5.2 lib/gloo/expr/l_integer.rb
gloo-0.5.1 lib/gloo/expr/l_integer.rb
gloo-0.5.0 lib/gloo/expr/l_integer.rb
gloo-0.4.0 lib/gloo/expr/l_integer.rb