Class: Irc::Bot::Config::IntegerValue
Instance Attribute Summary
Attributes inherited from Value
#auth_path, #desc, #key, #manager, #order, #requires_rescan, #requires_restart, #type, #wizard
Instance Method Summary collapse
Methods inherited from Value
#default, #initialize, #set, #set_string, #to_s, #unset
Constructor Details
This class inherits a constructor from Irc::Bot::Config::Value
Instance Method Details
#get ⇒ Object
148 149 150 151 152 153 154 155 |
# File 'lib/rbot/config.rb', line 148 def get r = super if r.kind_of?(Integer) return r else return r ? 1 : 0 end end |
#parse(string) ⇒ Object
142 143 144 145 146 147 |
# File 'lib/rbot/config.rb', line 142 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 |