From 1ff425a02303bf84743eb489487172f55082e384 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 6 Oct 2010 20:52:29 +0200 Subject: 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. --- lib/rbot/registry/tc.rb | 6 +++--- 1 file 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 -- cgit v1.2.3