From 7f244f32d974cafa74f449853f940f194d08d6d2 Mon Sep 17 00:00:00 2001 From: David Gadling Date: Thu, 21 May 2009 11:53:19 -0700 Subject: multiple plugins: Changes to remove parenthesize warnings. All of these modules/plugins were generating warnings like this: warning: parenthesize argument(s) for future version This patch should fix all the warnings without affecting functionality. --- data/rbot/plugins/games/shiritori.rb | 2 +- data/rbot/plugins/keywords.rb | 10 +++++----- data/rbot/plugins/lart.rb | 4 ++-- data/rbot/plugins/quotes.rb | 4 ++-- data/rbot/plugins/urban.rb | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'data/rbot') diff --git a/data/rbot/plugins/games/shiritori.rb b/data/rbot/plugins/games/shiritori.rb index 92f4dda4..3cb3c7b5 100644 --- a/data/rbot/plugins/games/shiritori.rb +++ b/data/rbot/plugins/games/shiritori.rb @@ -390,7 +390,7 @@ class ShiritoriPlugin < Plugin if ruleset.has_key?(:wordlist_file) begin ruleset[:words] = - File.new(datafile ruleset[:wordlist_file]).grep( + File.new(datafile(ruleset[:wordlist_file])).grep( ruleset[:listen]) {|l| ruleset[:normalize].call l.chomp} rescue raise "unable to load word list" diff --git a/data/rbot/plugins/keywords.rb b/data/rbot/plugins/keywords.rb index 58fcfe9b..da320780 100644 --- a/data/rbot/plugins/keywords.rb +++ b/data/rbot/plugins/keywords.rb @@ -138,7 +138,7 @@ class Keywords < Plugin # have been added def scan # first scan for old DBHash files, and convert them - Dir[datafile '*'].each {|f| + Dir[datafile('*')].each {|f| next unless f =~ /\.db$/ log "upgrading keyword db #{f} (rbot 0.9.5 or prior) database format" newname = f.gsub(/\.db$/, ".kdb") @@ -153,7 +153,7 @@ class Keywords < Plugin } # then scan for current DBTree files, and load them - Dir[@bot.path 'keywords', '*'].each {|f| + Dir[@bot.path('keywords', '*')].each {|f| next unless f =~ /\.kdb$/ hsh = DBTree.new @bot, f, true key = File.basename(f).gsub(/\.kdb$/, "") @@ -162,7 +162,7 @@ class Keywords < Plugin } # then scan for non DB files, and convert/import them and delete - Dir[@bot.path 'keywords', '*'].each {|f| + Dir[@bot.path('keywords', '*')].each {|f| next if f =~ /\.kdb$/ next if f =~ /CVS$/ log "auto converting keywords from #{f}" @@ -202,7 +202,7 @@ class Keywords < Plugin File.rename(olds, olds + ".old") end - olds.replace(@bot.path 'keyword.db') + olds.replace(@bot.path('keyword.db')) if File.exist? olds log "upgrading old keywords (rbot 0.9.9 or prior) database format" old = BDB::CIBtree.open olds, nil, "r+", 0600 @@ -221,7 +221,7 @@ class Keywords < Plugin end def oldsave - File.open(@bot.path "keywords.rbot", "w") do |file| + File.open(@bot.path("keywords.rbot"), "w") do |file| @keywords.each do |key, value| file.puts "#{key}<=#{value.type}=>#{value.dump}" end diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb index 4c945889..aeaad733 100644 --- a/data/rbot/plugins/lart.rb +++ b/data/rbot/plugins/lart.rb @@ -45,8 +45,8 @@ class LartPlugin < Plugin @oldpraise = datafile 'praise' end - @lartfile.replace(datafile "larts-#{lang}") - @praisefile.replace(datafile "praises-#{lang}") + @lartfile.replace(datafile("larts-#{lang}")) + @praisefile.replace(datafile("praises-#{lang}")) @larts.clear @praises.clear if File.exists? @lartfile diff --git a/data/rbot/plugins/quotes.rb b/data/rbot/plugins/quotes.rb index 59234e70..bb5ae57e 100644 --- a/data/rbot/plugins/quotes.rb +++ b/data/rbot/plugins/quotes.rb @@ -16,7 +16,7 @@ class QuotePlugin < Plugin super @lists = Hash.new @changed = Hash.new - Dir[datafile '*'].each {|f| + Dir[datafile('*')].each {|f| next if File.directory?(f) channel = File.basename(f) @lists[channel] = Array.new if(!@lists.has_key?(channel)) @@ -36,7 +36,7 @@ class QuotePlugin < Plugin begin if @changed[channel] debug "Writing new quotefile for channel #{channel} ..." - Utils.safe_save(datafile channel) {|file| + Utils.safe_save(datafile(channel)) {|file| quotes.compact.each {|q| file.puts "#{q.num} | #{q.date} | #{q.source} | #{q.quote}" } diff --git a/data/rbot/plugins/urban.rb b/data/rbot/plugins/urban.rb index 24c11dd7..6f052fcf 100644 --- a/data/rbot/plugins/urban.rb +++ b/data/rbot/plugins/urban.rb @@ -17,7 +17,7 @@ class UrbanPlugin < Plugin u = URBAN + URI.escape(word) u += '&page=' + p.to_s if p > 1 s = @bot.httputil.get(u) - return m.reply "Couldn't get the urban dictionary definition for #{word}" if s.nil? + return m.reply("Couldn't get the urban dictionary definition for #{word}") if s.nil? notfound = s.match %r{
.*? isn't defined} @@ -48,7 +48,7 @@ class UrbanPlugin < Plugin resp = @bot.httputil.head('http://www.urbandictionary.com/random.php', :max_redir => -1, :cache => false) - return m.reply "Couldn't get a random urban dictionary word" if resp.nil? + return m.reply("Couldn't get a random urban dictionary word") if resp.nil? if resp.code == "302" && (loc = resp['location']) words = URI.unescape(loc.match(/define.php\?term=(.*)$/)[1]) rescue nil end -- cgit v1.2.3