summaryrefslogtreecommitdiff
path: root/rbot/registry.rb
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-07-16 01:18:13 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-07-16 01:18:13 +0000
commita08b4def5c276df964ae2a8d9c3f661593d757e6 (patch)
treecd563b11ab095bd364036d14bc28fb5fb4c065a8 /rbot/registry.rb
parent71e16adb8a62a78fc1e8cdcc6776b6cd84fbe758 (diff)
various fixes by me, plus most of Rene's patch (#1).
Diffstat (limited to 'rbot/registry.rb')
-rw-r--r--rbot/registry.rb20
1 files changed, 9 insertions, 11 deletions
diff --git a/rbot/registry.rb b/rbot/registry.rb
index 751ec9a6..cd78dcbf 100644
--- a/rbot/registry.rb
+++ b/rbot/registry.rb
@@ -207,13 +207,13 @@ module Irc
# just like Hash#has_value?
def has_value?(value)
- return @registry.has_value(store(value))
+ return @registry.has_value?(store(value))
end
# just like Hash#index?
def index(value)
ind = @registry.index(store(value))
- if ind.gsub!(/^#{Regexp.escape(@prefix)}/, "")
+ if ind && ind.gsub!(/^#{Regexp.escape(@prefix)}/, "")
return ind
else
return nil
@@ -228,12 +228,12 @@ module Irc
# returns a list of your keys
def keys
return @registry.keys.collect {|key|
- if key.gsub!(/^#{Regexp.escape(@prefix)}/, "")
- key
- else
- nil
- end
- }.compact
+ if key.gsub!(/^#{Regexp.escape(@prefix)}/, "")
+ key
+ else
+ nil
+ end
+ }.compact
end
# Return an array of all associations [key, value] in your namespace
@@ -272,9 +272,7 @@ module Irc
def values
ret = Array.new
self.each {|k,v|
- if key =~ /^#{Regexp.escape(@prefix)}/
- Array << restore(v)
- end
+ ret << restore(v)
}
return ret
end