diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-02-22 00:25:35 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2009-02-22 01:58:05 +0100 |
commit | 1f0d0215fc076a921258d969b2022721ae05b71a (patch) | |
tree | ef6eaf3069d4ba566e24ce0ffcf49748b83402b8 | |
parent | 783ffa4235330029d661752b1023db635b26f2b3 (diff) |
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).
-rw-r--r-- | lib/rbot/registry.rb | 4 |
1 files changed, 2 insertions, 2 deletions
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 |