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

Inherits:
Value show all
Defined in:
/home/apoc/projects/ruby/rbot/lib/rbot/config.rb

Instance Attribute Summary

Attributes inherited from Value

#auth_path, #desc, #key, #manager, #order, #requires_rescan, #requires_restart, #store_default, #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

- (Object) parse(string)

Raises:

  • (ArgumentError)


161
162
163
164
# File '/home/apoc/projects/ruby/rbot/lib/rbot/config.rb', line 161

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