diff options
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/config.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/rbot/config.rb b/lib/rbot/config.rb index 360cba01..5661b3d1 100644 --- a/lib/rbot/config.rb +++ b/lib/rbot/config.rb @@ -70,11 +70,13 @@ module Config @manager.config[@key] = value @manager.changed = true @on_change.call(@manager.bot, value) if on_change && @on_change + return self end def unset @manager.config.delete(@key) @manager.changed = true @on_change.call(@manager.bot, value) if @on_change + return self end # set string will raise ArgumentErrors on failed parse/validate @@ -287,9 +289,13 @@ module Config return false end - # TODO should I implement this via Value or leave it direct? - # def []=(key, value) - # end + def []=(key, value) + return @items[key.to_sym].set(value) if @items.has_key?(key.to_sym) + if @config.has_key?(key.to_sym) + warning _("Unregistered lookup #{key.to_sym.inspect}") + return @config[key.to_sym] = value + end + end # pass everything else through to the hash def method_missing(method, *args, &block) |