class Irc::Bot::Config::IntegerValue

Public Instance Methods

get() click to toggle source
Calls superclass method Irc::Bot::Config::Value#get
# File lib/rbot/config.rb, line 150
def get
  r = super
  if r.kind_of?(Integer)
    return r
  else
    return r ? 1 : 0
  end
end
parse(string) click to toggle source
# File lib/rbot/config.rb, line 144
def parse(string)
  return 1 if string == "true"
  return 0 if string == "false"
  raise ArgumentError, "not an integer: #{string}" unless string =~ /^-?\d+$/
  string.to_i
end