diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-01-12 22:15:12 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2011-01-12 22:15:12 +0100 |
commit | 12a508e1a75bc1de501f36ca9e4767f2349fe12e (patch) | |
tree | 8ec4db236d70c064742b87c79feb86e783312e1c /data/rbot/plugins/geoip.rb | |
parent | cafa66beb3392f30ba8f11e6763f690518512471 (diff) |
Ruby 1.9 cleanup: variables warnings
Fix most ruby 1.9 warnings about shadowed variables (still one remaining in
keywords.rb). The only significant changes are in the quiz game plugin.
Also fix an issue in dictclient where the block parameter of a method
was not correctly isolated from the previous parameter.
Diffstat (limited to 'data/rbot/plugins/geoip.rb')
-rwxr-xr-x | data/rbot/plugins/geoip.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/data/rbot/plugins/geoip.rb b/data/rbot/plugins/geoip.rb index c67f1095..c76310d5 100755 --- a/data/rbot/plugins/geoip.rb +++ b/data/rbot/plugins/geoip.rb @@ -70,6 +70,12 @@ module ::GeoIP end end + JUMP_TABLE = { + "ipinfodb" => Proc.new { |ip| ipinfodb(ip) }, + "kapsi" => Proc.new { |ip| kapsi(ip) }, + "geoiptool" => Proc.new { |ip| geoiptool(ip) }, + } + def self.resolve(hostname, api) raise InvalidHostError unless valid_host?(hostname) @@ -79,15 +85,9 @@ module ::GeoIP raise InvalidHostError end - jump_table = { - "ipinfodb" => Proc.new { |ip| ipinfodb(ip) }, - "kapsi" => Proc.new { |ip| kapsi(ip) }, - "geoiptool" => Proc.new { |ip| geoiptool(ip) }, - } - - raise BadAPIError unless jump_table.key?(api) + raise BadAPIError unless JUMP_TABLE.key?(api) - return jump_table[api].call(ip) + return JUMP_TABLE[api].call(ip) end end @@ -153,7 +153,7 @@ class GeoIpPlugin < Plugin if m.replyto.class == Channel # check if there is an user on the channel with nick same as input given - user = m.replyto.users.find { |user| user.nick == params[:input] } + user = m.replyto.users.find { |usr| usr.nick == params[:input] } if user m.reply host2output(user.host, user.nick) |