Sha256: 37ecda413c40e12f714256722c08d062ee371ff68c10f8b6a9c9d2a97737ace0
Contents?: true
Size: 766 Bytes
Versions: 2
Compression:
Stored size: 766 Bytes
Contents
require_relative 'base' module Semi::Variables class Integer < Semi::Variables::Base #def set(val) # # test to see if the value is a common true value # if value =~ /true|yes|enable/i # @value = true # elsif value =~ /false|no|disable/i # @value = false # else # raise Semi::VariableError, "#{val} trying to be set as a boolean" # end #end def validate self.validate(@value) end def self.validate(value) if value.class == Fixnum 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
semi-0.7.1 | lib/semi/variables/integer.rb |
semi-0.7.0 | lib/semi/variables/integer.rb |