summaryrefslogtreecommitdiff
path: root/lib/rbot/registry/tc.rb
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-10-06 20:52:29 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2010-10-06 20:52:29 +0200
commit1ff425a02303bf84743eb489487172f55082e384 (patch)
treefcdb260f831cecb80c0aa559634121c78d77b5f8 /lib/rbot/registry/tc.rb
parent7444678a7d58f217f29096d88d057f6ed5ec0cd1 (diff)
TokyoCabinet #fwmkeys() expects a string
Convert the (optional) first argument to #each*() methods to a string to ensure the calls work as expected. This fixes a problem with @registry.each not working as expected, and although it would have been sufficient to convert the default for the first argument from nil to the empty string, the approach implemented by this patch is more robust overall.
Diffstat (limited to 'lib/rbot/registry/tc.rb')
-rw-r--r--lib/rbot/registry/tc.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/rbot/registry/tc.rb b/lib/rbot/registry/tc.rb
index b735927c..c114a1be 100644
--- a/lib/rbot/registry/tc.rb
+++ b/lib/rbot/registry/tc.rb
@@ -405,7 +405,7 @@ class Bot
# just like Hash#each
def each(set=nil, bulk=0, &block)
return nil unless File.exist?(@filename)
- registry.fwmkeys(set).each {|key|
+ registry.fwmkeys(set.to_s).each {|key|
block.call(key, restore(registry[key]))
}
end
@@ -413,7 +413,7 @@ class Bot
# just like Hash#each_key
def each_key(set=nil, bulk=0, &block)
return nil unless File.exist?(@filename)
- registry.fwmkeys(set).each do |key|
+ registry.fwmkeys(set.to_s).each do |key|
block.call(key)
end
end
@@ -421,7 +421,7 @@ class Bot
# just like Hash#each_value
def each_value(set=nil, bulk=0, &block)
return nil unless File.exist?(@filename)
- registry.fwmkeys(set).each do |key|
+ registry.fwmkeys(set.to_s).each do |key|
block.call(restore(registry[key]))
end
end