Class: ConfigInteger

Inherits:
ConfigString show all
Defined in:
lib/helpers.rb

Instance Method Summary collapse

Methods inherited from ConfigString

#add, #clear, #initialize, #name, #set, #to_s, #value

Constructor Details

This class inherits a constructor from ConfigString

Instance Method Details

#check(value) ⇒ Object



127
128
129
130
131
132
# File 'lib/helpers.rb', line 127

def check(value)
  raise "Format #{value} not valid for an integer in '#{name}'!" unless value.to_i.to_s == value if value.class == String
  value = value.to_i
  raise "'#{name}' must be positive, you set it to #{value}!" unless value >= 0 if @positive
  value
end