summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-01-12 22:15:12 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2011-01-12 22:15:12 +0100
commit12a508e1a75bc1de501f36ca9e4767f2349fe12e (patch)
tree8ec4db236d70c064742b87c79feb86e783312e1c /lib
parentcafa66beb3392f30ba8f11e6763f690518512471 (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 'lib')
-rw-r--r--lib/rbot/botuser.rb4
-rw-r--r--lib/rbot/core/auth.rb2
-rw-r--r--lib/rbot/core/utils/filters.rb6
-rw-r--r--lib/rbot/core/utils/httputil.rb2
-rwxr-xr-xlib/rbot/core/utils/wordlist.rb4
5 files changed, 8 insertions, 10 deletions
diff --git a/lib/rbot/botuser.rb b/lib/rbot/botuser.rb
index f7e41d97..4e93beb4 100644
--- a/lib/rbot/botuser.rb
+++ b/lib/rbot/botuser.rb
@@ -90,8 +90,8 @@ class Bot
#
def initialize(cmd)
cmdpath = sanitize_command_path(cmd).split('::')
- seq = cmdpath.inject(["*"]) { |list, cmd|
- list << (list.length > 1 ? list.last + "::" : "") + cmd
+ seq = cmdpath.inject(["*"]) { |list, cc|
+ list << (list.length > 1 ? list.last + "::" : "") + cc
}
@path = seq.map { |k|
k.to_sym
diff --git a/lib/rbot/core/auth.rb b/lib/rbot/core/auth.rb
index 30f99ecf..465f8f5d 100644
--- a/lib/rbot/core/auth.rb
+++ b/lib/rbot/core/auth.rb
@@ -713,7 +713,7 @@ class AuthModule < CoreBotModule
def auth_list_users(m, params)
# TODO name regexp to filter results
- list = @bot.auth.save_array.inject([]) { |list, x| ['everyone', 'owner'].include?(x[:username]) ? list : list << x[:username] }
+ list = @bot.auth.save_array.inject([]) { |lst, x| ['everyone', 'owner'].include?(x[:username]) ? lst : lst << x[:username] }
if defined?(@destroy_q)
list.map! { |x|
@destroy_q.include?(x) ? x + _(" (queued for destruction)") : x
diff --git a/lib/rbot/core/utils/filters.rb b/lib/rbot/core/utils/filters.rb
index 463e6f38..d188aa3f 100644
--- a/lib/rbot/core/utils/filters.rb
+++ b/lib/rbot/core/utils/filters.rb
@@ -177,10 +177,10 @@ module ::Irc
def load_filters(options={})
case options[:path]
when nil
- file = "#{self.dirname}.rb"
+ us = "#{self.dirname}.rb"
paths = [
- File.join(Config::datadir, 'filters', file),
- @bot.path('filters', file)
+ File.join(Config::datadir, 'filters', us),
+ @bot.path('filters', us)
]
when Array
paths = options[:path]
diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/core/utils/httputil.rb
index 25df3c5b..03671cfe 100644
--- a/lib/rbot/core/utils/httputil.rb
+++ b/lib/rbot/core/utils/httputil.rb
@@ -531,8 +531,6 @@ class HttpUtil
:method => :GET
}.merge(options)
- resp = nil
-
req_class = case opts[:method].to_s.downcase.intern
when :head, :"net::http::head"
opts[:max_redir] = -1
diff --git a/lib/rbot/core/utils/wordlist.rb b/lib/rbot/core/utils/wordlist.rb
index 4e624f9b..81d7d775 100755
--- a/lib/rbot/core/utils/wordlist.rb
+++ b/lib/rbot/core/utils/wordlist.rb
@@ -14,10 +14,10 @@ class Wordlist
@@wordlist_base ||= Utils.bot.path 'wordlists'
end
- def self.get(path, options={})
+ def self.get(where, options={})
opts = { :spaces => false }.merge(options)
- wordlist_path = File.join(wordlist_base, path)
+ wordlist_path = File.join(wordlist_base, where)
raise "wordlist not found: #{wordlist_path}" unless File.exist?(wordlist_path)
# Location is a directory -> combine all lists beneath it