Class: Irc::Bot::Config::FloatValue

Inherits:
Value show all
Defined in:
lib/rbot/config.rb

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, #get, #initialize, #set, #set_string, #to_s, #unset

Constructor Details

This class inherits a constructor from Irc::Bot::Config::Value

Instance Method Details

#parse(string) ⇒ Object

Raises:

  • (ArgumentError)


159
160
161
162
# File 'lib/rbot/config.rb', line 159

def parse(string)
  raise ArgumentError, "not a float #{string}" unless string =~ /^-?[\d.]+$/
  string.to_f
end