From 1f0d0215fc076a921258d969b2022721ae05b71a Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 22 Feb 2009 00:25:35 +0100 Subject: registry: spare useless I/O The each_key()/each_value() methods of the accessor relied on the each() method of the database, wasting I/O bandwidth and time by loading unnecessary data (particularly when running each_key() on databases with ridiculously enormous values such as in the markov plugin case). --- lib/rbot/registry.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/rbot') diff --git a/lib/rbot/registry.rb b/lib/rbot/registry.rb index 05425341..4dfbdb35 100644 --- a/lib/rbot/registry.rb +++ b/lib/rbot/registry.rb @@ -230,7 +230,7 @@ class Bot # just like Hash#each_key def each_key(&block) return nil unless File.exist?(@filename) - registry.each {|key, value| + registry.each_key {|key| block.call(key) } end @@ -238,7 +238,7 @@ class Bot # just like Hash#each_value def each_value(&block) return nil unless File.exist?(@filename) - registry.each {|key, value| + registry.each_value { |value| block.call(restore(value)) } end -- cgit v1.2.3