class Irc::Bot::Config::BooleanValue

Public Instance Methods

get() click to toggle source
Calls superclass method Irc::Bot::Config::Value#get
# File lib/rbot/config.rb, line 131
def get
  r = super
  if r.kind_of?(Integer)
    return r != 0
  else
    return r
  end
end
parse(string) click to toggle source
# File lib/rbot/config.rb, line 123
def parse(string)
  return true if string == "true"
  return false if string == "false"
  if string =~ /^-?\d+$/
    return string.to_i != 0
  end
  raise ArgumentError, "#{string} does not match either 'true' or 'false', and it's not an integer either"
end