Sha256: a5c0dfaa3aabff82cda642201502186cd449401687e17d8d228b9fc04f07d5d1

Contents?: true

Size: 457 Bytes

Versions: 5

Compression:

Stored size: 457 Bytes

Contents

require_relative 'base'

module Semi::Variables
  class Integer < Semi::Variables::Base

    def validate
      self.validate(@value)
    end

    def self.validate(value)
      if value.class == 1.class
        return true
      elsif value.class == Semi::Variables::Integer and value.to_s =~ /^\d+$/
        return true
      end
      false
    end

    def method_missing(m, *args, &block)
        @value.to_i.send(m, *args, &block)
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
semi-0.8.6 lib/semi/variables/integer.rb
semi-0.8.5 lib/semi/variables/integer.rb
semi-0.8.4 lib/semi/variables/integer.rb
semi-0.8.3 lib/semi/variables/integer.rb
semi-0.8.2 lib/semi/variables/integer.rb