From 12a508e1a75bc1de501f36ca9e4767f2349fe12e Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 12 Jan 2011 22:15:12 +0100 Subject: 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. --- lib/rbot/botuser.rb | 4 ++-- lib/rbot/core/auth.rb | 2 +- lib/rbot/core/utils/filters.rb | 6 +++--- lib/rbot/core/utils/httputil.rb | 2 -- lib/rbot/core/utils/wordlist.rb | 4 ++-- 5 files changed, 8 insertions(+), 10 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3