From 783ffa4235330029d661752b1023db635b26f2b3 Mon Sep 17 00:00:00 2001 From: Raine Virta Date: Thu, 19 Feb 2009 16:26:34 +0200 Subject: [PATCH] remove whitespace --- data/rbot/contrib/plugins/stats.rb | 6 +-- data/rbot/contrib/plugins/vandale.rb | 2 +- data/rbot/plugins/alias.rb | 8 ++-- data/rbot/plugins/bans.rb | 2 +- data/rbot/plugins/bash.rb | 4 +- data/rbot/plugins/cal.rb | 2 +- data/rbot/plugins/chucknorris.rb | 12 +++--- data/rbot/plugins/deepthoughts.rb | 2 +- data/rbot/plugins/dictclient.rb | 24 +++++------ data/rbot/plugins/digg.rb | 6 +-- data/rbot/plugins/fish.rb | 2 +- data/rbot/plugins/forecast.rb | 6 +-- data/rbot/plugins/fortune.rb | 4 +- data/rbot/plugins/freshmeat.rb | 4 +- data/rbot/plugins/games/azgame.rb | 4 +- data/rbot/plugins/games/quiz.rb | 6 +-- data/rbot/plugins/games/roshambo.rb | 2 +- data/rbot/plugins/games/roulette.rb | 8 ++-- data/rbot/plugins/games/shiritori.rb | 60 ++++++++++++++-------------- data/rbot/plugins/games/uno.rb | 4 +- data/rbot/plugins/googlefight.rb | 18 ++++----- data/rbot/plugins/imdb.rb | 2 +- data/rbot/plugins/insult.rb | 4 +- data/rbot/plugins/karma.rb | 2 +- data/rbot/plugins/linkbot.rb | 2 +- data/rbot/plugins/markov.rb | 6 +-- data/rbot/plugins/math.rb | 6 +-- data/rbot/plugins/modes.rb | 2 +- data/rbot/plugins/nickrecover.rb | 2 +- data/rbot/plugins/nickserv.rb | 8 ++-- data/rbot/plugins/nslookup.rb | 4 +- data/rbot/plugins/quakeauth.rb | 6 +-- data/rbot/plugins/quotes.rb | 4 +- data/rbot/plugins/reaction.rb | 2 +- data/rbot/plugins/remind.rb | 4 +- data/rbot/plugins/ri.rb | 2 +- data/rbot/plugins/rss.rb | 8 ++-- data/rbot/plugins/salut.rb | 6 +-- data/rbot/plugins/script.rb | 12 +++--- data/rbot/plugins/search.rb | 26 ++++++------ data/rbot/plugins/seen.rb | 16 ++++---- data/rbot/plugins/shortenurls.rb | 2 +- data/rbot/plugins/slashdot.rb | 10 ++--- data/rbot/plugins/theyfightcrime.rb | 20 +++++----- data/rbot/plugins/time.rb | 4 +- data/rbot/plugins/translator.rb | 4 +- data/rbot/plugins/tube.rb | 4 +- data/rbot/plugins/weather.rb | 8 ++-- data/rbot/plugins/wserver.rb | 10 ++--- lib/rbot/botuser.rb | 2 +- lib/rbot/core/basics.rb | 2 +- lib/rbot/core/filters_ui.rb | 4 +- lib/rbot/core/irclog.rb | 2 +- lib/rbot/core/remote.rb | 2 +- lib/rbot/core/userdata.rb | 2 +- lib/rbot/core/utils/httputil.rb | 2 +- lib/rbot/core/utils/utils.rb | 4 +- lib/rbot/dbhash.rb | 2 +- lib/rbot/irc.rb | 8 ++-- lib/rbot/language.rb | 6 +-- lib/rbot/message.rb | 2 +- lib/rbot/messagemapper.rb | 2 +- lib/rbot/plugins.rb | 8 ++-- lib/rbot/timer.rb | 2 +- msgmerge-wrapper.rb | 2 +- setup.rb | 8 ++-- test/test_plugins_priority.rb | 6 +-- test/test_plugins_threshold.rb | 8 ++-- 68 files changed, 223 insertions(+), 223 deletions(-) diff --git a/data/rbot/contrib/plugins/stats.rb b/data/rbot/contrib/plugins/stats.rb index 4cafbbe9..97f42bd3 100644 --- a/data/rbot/contrib/plugins/stats.rb +++ b/data/rbot/contrib/plugins/stats.rb @@ -19,10 +19,10 @@ class StatsPlugin < Plugin - @@commands = { + @@commands = { "stats" => "handle_stats", "track" => "handle_track", - "untrack" => "handle_untrack", + "untrack" => "handle_untrack", "listtokens" => "handle_listtokens", "rmabuser" => "handle_rmabuser" } @@ -61,7 +61,7 @@ class StatsPlugin < Plugin m.reply "What a crazy fool! Did you mean |help stats?" return end - + meth = self.method(@@commands[m.plugin]) meth.call(m) end diff --git a/data/rbot/contrib/plugins/vandale.rb b/data/rbot/contrib/plugins/vandale.rb index 7b806c85..720fe762 100644 --- a/data/rbot/contrib/plugins/vandale.rb +++ b/data/rbot/contrib/plugins/vandale.rb @@ -16,7 +16,7 @@ class VanDalePlugin < Plugin ret = Array.new Utils.safe_exec("/usr/local/bin/gnuvd", m.params).each{|line| if line.length > 5 then ret << line end} m.reply ret.delete_at(0) - while ret[0] =~ /^[[:alpha:]_]*[0-9]/ + while ret[0] =~ /^[[:alpha:]_]*[0-9]/ m.reply ret.delete_at(0) end while ret[0] =~ /^[0-9]/ diff --git a/data/rbot/plugins/alias.rb b/data/rbot/plugins/alias.rb index 58d0ef01..89be0020 100644 --- a/data/rbot/plugins/alias.rb +++ b/data/rbot/plugins/alias.rb @@ -58,10 +58,10 @@ class AliasPlugin < Plugin warning _("Invalid alias entry %{alias} : %{command} in %{filename}: %{reason}") % {:alias => a, :command => c, :filename => @data_file, :reason => $1} end - end - end + end + end - def save + def save FileUtils.mkdir_p(@data_path) Utils.safe_save(@data_file) {|f| f.write @aliases.to_yaml} end @@ -110,7 +110,7 @@ class AliasPlugin < Plugin command.scan(/<(\w+)>/).flatten.to_set == text.split.grep(/\A[:*](\w+)\Z/) {$1}.to_set or raise AliasDefinitionError.new(_('The arguments in alias must match the substitutions in command, and vice versa')) - + begin map text, :action => :"alias_handle<#{text}>", :auth_path => 'run' rescue diff --git a/data/rbot/plugins/bans.rb b/data/rbot/plugins/bans.rb index f80dd70f..99b664df 100644 --- a/data/rbot/plugins/bans.rb +++ b/data/rbot/plugins/bans.rb @@ -458,7 +458,7 @@ class BansPlugin < Plugin when /^(\d+)m$/ timer = $1.to_i * 60 when /^(\d+)h$/ - timer = $1.to_i * 60 * 60 + timer = $1.to_i * 60 * 60 when /^(\d+)d$/ timer = $1.to_i * 60 * 60 * 24 else diff --git a/data/rbot/plugins/bash.rb b/data/rbot/plugins/bash.rb index 16028356..8dac9671 100644 --- a/data/rbot/plugins/bash.rb +++ b/data/rbot/plugins/bash.rb @@ -172,7 +172,7 @@ class BashPlugin < Plugin xml = @bot.httputil.get("http://bash.org/xml/?random&num=1", :cache => false) else xml = @bot.httputil.get("http://bash.org/xml/?" + id + "&num=1") - end + end unless xml m.reply "bash.org rss parse failed" @@ -184,7 +184,7 @@ class BashPlugin < Plugin return end doc.elements.each("*/item") {|e| - if(id != 0) + if(id != 0) reply = e.elements["title"].text.gsub(/QDB: /,"") + " " + e.elements["link"].text.gsub(/QDB: /,"") + "\n" reply = reply + e.elements["description"].text.gsub(/\
/, "\n") else diff --git a/data/rbot/plugins/cal.rb b/data/rbot/plugins/cal.rb index 9190f8e9..c649084a 100644 --- a/data/rbot/plugins/cal.rb +++ b/data/rbot/plugins/cal.rb @@ -6,7 +6,7 @@ class CalPlugin < Plugin def help(plugin, topic="") "cal [month year] => show current calendar [optionally specify month and year]" end - + def cal_path @bot.config["cal.path"] end diff --git a/data/rbot/plugins/chucknorris.rb b/data/rbot/plugins/chucknorris.rb index bf9d70f4..6b6c4f98 100644 --- a/data/rbot/plugins/chucknorris.rb +++ b/data/rbot/plugins/chucknorris.rb @@ -16,20 +16,20 @@ class ChuckNorrisPlugin < Plugin else raise "Error: Couldn't find chucknorris.yml[.gz]" end - + debug "+ [chucknorris] Loading #{path}..." - + @@facts = YAML.load(fyml).map{|fact,(score,votes)| votes >= MIN_VOTES ? [score,fact] : nil}.compact debug "+ [chucknorris] #{@@facts.length} Chuck Norris facts loaded..." debug " Random fact: #{@@facts[rand(@@facts.size)].inspect}" - + super end def name "chucknorris" end - + # Just a little helper for the initialize method... def find_facts_file(name) full_path = File.join Config::datadir, "plugins", name @@ -40,11 +40,11 @@ class ChuckNorrisPlugin < Plugin found_files[0] end end - + # HELP! def help(plugin, topic="chuck") "chuck|norris|chucknorris [min_rating] => show a random Chuck Norris fact (optional minimum rating from 1-10, default=6.0)." - #\"fact [person]\" shows a fact about someone in the channel. + #\"fact [person]\" shows a fact about someone in the channel. end # The meat. diff --git a/data/rbot/plugins/deepthoughts.rb b/data/rbot/plugins/deepthoughts.rb index b1171bae..a6b4e80f 100644 --- a/data/rbot/plugins/deepthoughts.rb +++ b/data/rbot/plugins/deepthoughts.rb @@ -79,7 +79,7 @@ class DeepThoughts < Plugin def help(plugin, topic="") "deepthought => think a deep thought." end - + def deepthought(m, params) m.reply THOUGHTS.pick_one end diff --git a/data/rbot/plugins/dictclient.rb b/data/rbot/plugins/dictclient.rb index 5b3bc631..d7e5091c 100644 --- a/data/rbot/plugins/dictclient.rb +++ b/data/rbot/plugins/dictclient.rb @@ -77,11 +77,11 @@ class DictClientPlugin < Plugin Config.register Config::StringValue.new('dictclient.match_format', :default => '––', :desc => _('Format of match results. will be replaced with the formatted headwords, with the formatted database name')) - + def initialize super end - + # create a DICT object, which is passed to the block. after the block finishes, # the DICT object is automatically disconnected. the return value of the block # is returned from this method. @@ -104,15 +104,15 @@ class DictClientPlugin < Plugin end ret end - + def format_headword(w) @bot.config['dictclient.headword_format'].gsub '', w end - + def format_database(d) @bot.config['dictclient.database_format'].gsub '', d end - + def cmd_define(m, params) phrase = params[:phrase].to_s results = with_dict(m) {|d| d.define(params[:database], params[:phrase])} @@ -122,7 +122,7 @@ class DictClientPlugin < Plugin # the number of definitions is above dictclient.max_defs_before_collapse if results.any? {|r| r.database != results[0].database} && results.length > @bot.config['dictclient.max_defs_before_collapse'] - _("Many definitions for %{phrase} were found in %{databases}. Use 'define from to view a definition.") % + _("Many definitions for %{phrase} were found in %{databases}. Use 'define from to view a definition.") % { :phrase => format_headword(phrase), :databases => results.collect {|r| r.database}.uniq. collect {|d| format_database d}.join(', ') } @@ -139,13 +139,13 @@ class DictClientPlugin < Plugin }.join ' | ' end else - _("No definition for %{phrase} found from %{database}.") % + _("No definition for %{phrase} found from %{database}.") % { :phrase => format_headword(phrase), :database => format_database(params[:database]) } end ) end - + def cmd_match(m, params) phrase = params[:phrase].to_s results = with_dict(m) {|d| d.match(params[:database], @@ -160,14 +160,14 @@ class DictClientPlugin < Plugin ) }.join ' ' else - _("Nothing matched %{query} from %{database} using %{strategy}") % + _("Nothing matched %{query} from %{database} using %{strategy}") % { :query => format_headword(phrase), :database => format_database(params[:database]), :strategy => params[:strategy] } end ) end - + def cmd_databases(m, params) with_dict(m) do |d| m.reply _("Databases: %{list}") % { @@ -175,7 +175,7 @@ class DictClientPlugin < Plugin } end end - + def cmd_strategies(m, params) with_dict(m) do |d| m.reply _("Strategies: %{list}") % { @@ -183,7 +183,7 @@ class DictClientPlugin < Plugin } end end - + def help(plugin, topic='') case topic when 'define' diff --git a/data/rbot/plugins/digg.rb b/data/rbot/plugins/digg.rb index dc2e41cf..25962919 100644 --- a/data/rbot/plugins/digg.rb +++ b/data/rbot/plugins/digg.rb @@ -9,7 +9,7 @@ class DiggPlugin < Plugin def help(plugin, topic="") "digg [=5] => show digg headlines, [=5] => return up to headlines (use a negative number to show all the headlines on one line)" end - + def digg(m, params) max = params[:limit].to_i debug "max is #{max}" @@ -32,11 +32,11 @@ class DiggPlugin < Plugin max = 8 if max > 8 matches = Array.new doc.elements.each("rss/channel/item") {|e| - matches << [ e.elements["title"].text, + matches << [ e.elements["title"].text, Time.parse(e.elements["pubDate"].text).strftime('%a @ %I:%M%p') ] done += 1 break if done >= max - } + } if oneline m.reply matches.collect{|mat| mat[0]}.join(" | ") else diff --git a/data/rbot/plugins/fish.rb b/data/rbot/plugins/fish.rb index 5b24d241..2394fa09 100644 --- a/data/rbot/plugins/fish.rb +++ b/data/rbot/plugins/fish.rb @@ -25,7 +25,7 @@ class BabelPlugin < Plugin trans_from = params[:fromlang] ? params[:fromlang] : @bot.config['translate.default_from'] trans_to = params[:tolang] ? params[:tolang] : @bot.config['translate.default_to'] trans_text = params[:phrase].to_s - + lang_match = langs.join("|") unless(trans_from =~ /^(#{lang_match})$/ && trans_to =~ /^(#{lang_match})$/) m.reply "invalid language: valid languagess are: #{langs.join(' ')}" diff --git a/data/rbot/plugins/forecast.rb b/data/rbot/plugins/forecast.rb index 1095886f..293c7c05 100644 --- a/data/rbot/plugins/forecast.rb +++ b/data/rbot/plugins/forecast.rb @@ -8,7 +8,7 @@ require 'soap/wsdlDriver' # TODO why not use HttpUtil instead of open-uri? -require 'open-uri' +require 'open-uri' require 'rexml/document' require 'erb' @@ -48,7 +48,7 @@ class Forecast return parse(retrieve),Time.new end private - def retrieve + def retrieve forecast = @forecaster.NDFDgenByDay( @lat,@long,Time.now.strftime("%Y-%m-%d"),2,"24 hourly") (REXML::Document.new(forecast)).root @@ -105,7 +105,7 @@ class ForecastPlugin < Plugin end end end - + def get_forecast(m,loc) begin @cache_mutex.synchronize do diff --git a/data/rbot/plugins/fortune.rb b/data/rbot/plugins/fortune.rb index 6612c111..3e2ffdf7 100644 --- a/data/rbot/plugins/fortune.rb +++ b/data/rbot/plugins/fortune.rb @@ -31,7 +31,7 @@ class FortunePlugin < Plugin end return nil unless fortune - + # Try setting the config entry config_par = {:key => 'fortune.path', :value => [fortune], :silent => true } debug "Setting fortune.path to #{fortune}" @@ -94,7 +94,7 @@ class FortunePlugin < Plugin ## say 'em! m.reply "Fortune categories: #{categories.join ', '}" end - + end plugin = FortunePlugin.new plugin.map 'fortune categories', :action => "categories" diff --git a/data/rbot/plugins/freshmeat.rb b/data/rbot/plugins/freshmeat.rb index dce6c0d4..3ae887d1 100644 --- a/data/rbot/plugins/freshmeat.rb +++ b/data/rbot/plugins/freshmeat.rb @@ -88,7 +88,7 @@ class FreshmeatPlugin < Plugin m.reply reply } end - + def freshmeat(m, params) max = params[:limit].to_i max = 8 if max > 8 @@ -134,5 +134,5 @@ end plugin = FreshmeatPlugin.new plugin.map 'freshmeat search :limit *search', :action => 'search_freshmeat', :defaults => {:limit => 4}, :requirements => {:limit => /^\d+$/} -plugin.map 'freshmeat :limit', :defaults => {:limit => 4}, +plugin.map 'freshmeat :limit', :defaults => {:limit => 4}, :requirements => {:limit => /^\d+$/} diff --git a/data/rbot/plugins/games/azgame.rb b/data/rbot/plugins/games/azgame.rb index 6e2526e2..572684d9 100644 --- a/data/rbot/plugins/games/azgame.rb +++ b/data/rbot/plugins/games/azgame.rb @@ -355,10 +355,10 @@ class AzGamePlugin < Plugin if wc[word].key?(:when) tr = _("%{word} learned from %{user} on %{date}") % {:word => word, :user => wc[word][:who], :date => wc[word][:when]} else - tr = _("%{word} learned from %{user}") % {:word => word, :user => wc[word][:who]} + tr = _("%{word} learned from %{user}") % {:word => word, :user => wc[word][:who]} end m.reply tr - when :delete + when :delete if pars.empty? m.reply _("provide a word") return diff --git a/data/rbot/plugins/games/quiz.rb b/data/rbot/plugins/games/quiz.rb index 9159a4c4..ca2abf47 100644 --- a/data/rbot/plugins/games/quiz.rb +++ b/data/rbot/plugins/games/quiz.rb @@ -184,7 +184,7 @@ class QuizPlugin < Plugin # (in quiz/) or web pages. # def fetch_data( m ) - # Read the winning messages file + # Read the winning messages file @win_messages = Array.new winfile = datafile 'win_messages' if File.exists? winfile @@ -339,7 +339,7 @@ class QuizPlugin < Plugin end end - # If less than all other players' scores, append to table + # If less than all other players' scores, append to table unless inserted i += 1 unless q.rank_table.empty? q.rank_table << [nick, stats] @@ -370,7 +370,7 @@ class QuizPlugin < Plugin message = m.message.downcase.strip - nick = m.sourcenick.to_s + nick = m.sourcenick.to_s # Support multiple alternate answers and cores answer = q.answers.find { |ans| ans.valid?(message) } diff --git a/data/rbot/plugins/games/roshambo.rb b/data/rbot/plugins/games/roshambo.rb index 03338698..927b2f08 100644 --- a/data/rbot/plugins/games/roshambo.rb +++ b/data/rbot/plugins/games/roshambo.rb @@ -15,7 +15,7 @@ require 'time' class RoshamboPlugin < Plugin def initialize - super + super @scoreboard = {} @beats = { :rock => :scissors, :paper => :rock, :scissors => :paper} @plays = @beats.keys diff --git a/data/rbot/plugins/games/roulette.rb b/data/rbot/plugins/games/roulette.rb index adf755fd..6d834788 100644 --- a/data/rbot/plugins/games/roulette.rb +++ b/data/rbot/plugins/games/roulette.rb @@ -2,13 +2,13 @@ define_structure :RouletteHistory, :games, :shots, :deaths, :misses, :wins class RoulettePlugin < Plugin Config.register Config::BooleanValue.new('roulette.autospin', - :default => true, + :default => true, :desc => "Automatically spins the roulette at the butlast shot") Config.register Config::BooleanValue.new('roulette.kick', - :default => false, + :default => false, :desc => "Kicks shot players from the channel") Config.register Config::BooleanValue.new('roulette.twice_in_a_row', - :default => false, + :default => false, :desc => "Allow players to go twice in a row") def initialize @@ -174,7 +174,7 @@ class RoulettePlugin < Plugin k = match[1] total_players += 1 - + win_rate = v.wins.to_f / v.games * 100 if h_win_percent[0].nil? || win_rate > h_win_percent[1] && v.games > 2 h_win_percent = [[k], win_rate] diff --git a/data/rbot/plugins/games/shiritori.rb b/data/rbot/plugins/games/shiritori.rb index 0b77871e..92f4dda4 100644 --- a/data/rbot/plugins/games/shiritori.rb +++ b/data/rbot/plugins/games/shiritori.rb @@ -1,7 +1,7 @@ #-- vim:sw=2:et #kate: indent-width 2 #++ -# +# # :title: Shiritori Plugin for RBot # # Author:: Yaohan Chen @@ -16,10 +16,10 @@ # players can interrupt a turn to join, or a free mode where anyone can speak at any # time. # -# In Japanese mode, if present, the plugin can use normalize-japanese +# In Japanese mode, if present, the plugin can use normalize-japanese # to allow # katakana words be used like hiragana. -# +# # TODO # * a system to describe settings, so they can be displayed, changed and saved # * adjust settings during game @@ -35,7 +35,7 @@ class Dictionary def has_word?(s) raise NotImplementedError end - + # whether any word starts with prefix, excluding words in excludes. This can be # possible with non-enumerable dictionaries since some dictionary engines provide # prefix searching. @@ -51,12 +51,12 @@ class WordlistDictionary < Dictionary @words = words # debug "Created dictionary with #{@words.length} words" end - + # whether string s is a word def has_word?(s) @words.include? s end - + # whether any word starts with prefix, excluding words in excludes def any_word_starting?(prefix, excludes) # (@words - except).any? {|w| w =~ /\A#{prefix}.+/} @@ -69,7 +69,7 @@ end # whether it's possible to continue a word class Shiritori attr_reader :used_words - + # dictionary:: a Dictionary object # overlap_lengths:: a Range for allowed lengths to overlap when continuing words # check_continuable:: whether all words are checked whether they're continuable, @@ -82,7 +82,7 @@ class Shiritori @allow_reuse = allow_reuse @used_words = [] end - + # Prefix of s with length n def head_of(s, n) # TODO ruby2 unicode @@ -102,7 +102,7 @@ class Shiritori def range_under(r, n) r.begin .. [r.end, n-1].min end - + # TODO allow the ruleset to customize this def continues?(w2, w1) # this uses the definition w1[-n,n] == w2[0,n] && n < [w1.length, w2.length].min @@ -110,7 +110,7 @@ class Shiritori range_under(@overlap_lengths, [len(w1), len(w2)].min).any? {|n| tail_of(w1, n)== head_of(w2, n)} end - + # Checks whether *any* unused word in the dictionary completes the word # This has the limitation that it can't detect when a word is continuable, but the # only continuers aren't continuable @@ -118,8 +118,8 @@ class Shiritori range_under(@overlap_lengths, len(s)).any? {|n| @dictionary.any_word_starting?(tail_of(s, n), @used_words) } end - - # Given a string, give a verdict based on current shiritori state and dictionary + + # Given a string, give a verdict based on current shiritori state and dictionary def process(s) # TODO optionally allow used words # TODO ruby2 unicode @@ -167,14 +167,14 @@ class ShiritoriGame @timer_handle = nil @say = say @when_die = when_die - + # TODO allow other forms of dictionaries dictionary = WordlistDictionary.new(@ruleset[:words]) @game = Shiritori.new(dictionary, @ruleset[:overlap_lengths], @ruleset[:check_continuable], @ruleset[:allow_reuse]) end - + def say(s) @say.call(s) end @@ -184,10 +184,10 @@ class ShiritoriGame # * when time_limit > 0, new players can join at any time, but existing players must # take turns, each of which expires after time_limit # * when time_imit is 0, anyone can speak in the game at any time - def take_turns? + def take_turns? @players.length > 1 && @ruleset[:time_limit] > 0 end - + # the player who has the current turn def current_player @players.first @@ -200,7 +200,7 @@ class ShiritoriGame def previous_word @game.used_words[-2] end - + # announce the current word, and player if take_turns? def announce say(if take_turns? @@ -237,13 +237,13 @@ class ShiritoriGame end announce end - + # handle when turn time limit goes out def time_out if @ruleset[:lose_when_timeout] say _("%{player} took too long and is out of the game. Try again next game!") % { :player => current_player } - if @players.length == 2 + if @players.length == 2 # 2 players before, and one should remain now # since the game is ending, save the trouble of removing and booting the player say _("%{player} is the last remaining player and the winner! Congratulations!") % @@ -269,12 +269,12 @@ class ShiritoriGame def handle_message(m) message = m.message speaker = m.sourcenick.to_s - + return unless @ruleset[:listen] =~ message # in take_turns mode, only new players are allowed to interrupt a turn return if @booted_players.include? speaker || - (take_turns? && + (take_turns? && speaker != current_player && (@players.length > 1 && @players.include?(speaker))) @@ -310,7 +310,7 @@ class ShiritoriGame m.reply _("It's impossible to continue the chain from %{word}. Start with another word.") % {:word => message} end end - + # end the game def die # redefine restart_timer to no-op @@ -331,11 +331,11 @@ class ShiritoriPlugin < Plugin _("A game in which each player must continue the previous player's word, by using its last one or few characters/letters of the word to start a new word. 'shiritori ' => Play shiritori with a set of rules. Available rulesets: %{rulesets}. 'shiritori stop' => Stop the current shiritori game.") % {:rulesets => @rulesets.keys.join(', ')} end - + def initialize() super @games = {} - + # TODO make rulesets more easily customizable # TODO initialize default ruleset from config # Default values of rulesets @@ -401,7 +401,7 @@ class ShiritoriPlugin < Plugin end return ruleset end - + # start shiritori in a channel def cmd_shiritori(m, params) if @games.has_key?( m.channel ) @@ -426,7 +426,7 @@ class ShiritoriPlugin < Plugin end end end - + # change rules for current game def cmd_set(m, params) require 'enumerator' @@ -434,7 +434,7 @@ class ShiritoriPlugin < Plugin params[:rules].each_slice(2) {|opt, value| new_rules[opt] = value} raise NotImplementedError end - + # stop the current game def cmd_stop(m, params) if @games.has_key? m.channel @@ -446,19 +446,19 @@ class ShiritoriPlugin < Plugin m.reply _("No game to stop here, because no game is being played.") end end - + # remove the game, so channel messages are no longer processed, and timer removed def remove_game(channel) @games.delete channel end - + # all messages from a channel is sent to its shiritori game if any def message(m) return unless @games.has_key?(m.channel) # send the message to the game in the channel to handle it @games[m.channel].handle_message m end - + # remove all games def cleanup @games.each_key {|g| g.die} diff --git a/data/rbot/plugins/games/uno.rb b/data/rbot/plugins/games/uno.rb index 5b2593ee..84420631 100644 --- a/data/rbot/plugins/games/uno.rb +++ b/data/rbot/plugins/games/uno.rb @@ -108,7 +108,7 @@ class UnoGame @color = 'Wild' raise if value and not value == '+4' if value - @value = value.dup + @value = value.dup @shortform = 'w'+value else @value = nil @@ -411,7 +411,7 @@ class UnoGame # only be possible if the first W+4 was illegal, so it wouldn't # apply for a W+4 played on a +2 anyway. # - if @picker == 0 and Wild === cards.first and cards.first.value + if @picker == 0 and Wild === cards.first and cards.first.value # save the previous discard in case of challenge @last_discard = @discard.dup # save the color too, in case it was a Wild diff --git a/data/rbot/plugins/googlefight.rb b/data/rbot/plugins/googlefight.rb index 3f7cf5a1..0b9393ef 100755 --- a/data/rbot/plugins/googlefight.rb +++ b/data/rbot/plugins/googlefight.rb @@ -11,18 +11,18 @@ class GoogleFightPlugin < Plugin def help(plugin, topic) "googlefight [... ] => battles given keywords based on amount of google search results and announces the winner!" end - + def fight(m, params) keywords = parse_keywords(params) return if keywords.nil? - + keywords.map! do |k| [k, google_count(k)] end - + m.reply output(keywords) end - + def output(result) result = result.sort_by { |e| e[1] }.reverse str = result.map do |kw| @@ -31,26 +31,26 @@ class GoogleFightPlugin < Plugin :count => kw[1].to_s.gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1,") } end.join(" vs. ") - + unless result[0][1].zero? str << _(" -- %{keyword} wins!") % { :keyword => Bold+result[0][0]+Bold } else str << _(" -- no winner here!") - end + end end - + def parse_keywords(params) str = params[:keywords].join(" ") - + # foo "foo bar" bar # no separators so assume they're all separate keywords if str.match(/(?:"[\w\s]+"|\w+)(?: (?:"[\w\s]+"|\w+))+/) str.scan(/"[^"]+"|\S+/).flatten end end - + def google_count(query) url = 'http://www.google.com/search?hl=en&safe=off&btnG=Search&q=' << CGI.escape(query) html = Net::HTTP.get(URI.parse((url))) diff --git a/data/rbot/plugins/imdb.rb b/data/rbot/plugins/imdb.rb index bfe27369..f3e6504d 100644 --- a/data/rbot/plugins/imdb.rb +++ b/data/rbot/plugins/imdb.rb @@ -469,7 +469,7 @@ class ImdbPlugin < Plugin end # Find the movies with a participation of :who in the year :year - # TODO: allow year to be either a year or a decade ('[in the] 1960s') + # TODO: allow year to be either a year or a decade ('[in the] 1960s') # def movies(m, params) who = params[:who].to_s diff --git a/data/rbot/plugins/insult.rb b/data/rbot/plugins/insult.rb index 0c449654..993450a5 100644 --- a/data/rbot/plugins/insult.rb +++ b/data/rbot/plugins/insult.rb @@ -134,7 +134,7 @@ class InsultPlugin < Plugin ] ## -# Amounts +# Amounts ## @@amt = [ "accumulation", @@ -206,7 +206,7 @@ class InsultPlugin < Plugin "cold sores", "anal warts", ] - + def help(plugin, topic="") return "[msg]insult me| => insult you or . msginsult insults in private" end diff --git a/data/rbot/plugins/karma.rb b/data/rbot/plugins/karma.rb index ad5f57a2..060e743e 100644 --- a/data/rbot/plugins/karma.rb +++ b/data/rbot/plugins/karma.rb @@ -55,7 +55,7 @@ class KarmaPlugin < Plugin @registry[thing] = params[:val].to_i karma(m, params) end - + def help(plugin, topic="") "karma module: Listens to everyone's chat. ++/-- => increase/decrease karma for , karma for ? => show karma for , karmastats => show stats. Karma is a community rating system - only in-channel messages can affect karma and you cannot adjust your own." end diff --git a/data/rbot/plugins/linkbot.rb b/data/rbot/plugins/linkbot.rb index 360735e9..b9e7f511 100644 --- a/data/rbot/plugins/linkbot.rb +++ b/data/rbot/plugins/linkbot.rb @@ -31,7 +31,7 @@ class LinkBot < Plugin :desc => "List of regexp which match linkbot messages; each regexp needs to have three captures, which in order are the nickname of the original speaker, network, and original message", :on_change => proc {|bot, v| bot.plugins['linkbot'].update_patterns}) # TODO use template strings instead of regexp for user friendliness - + # Initialize the plugin def initialize super diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb index 089d939d..dd66ae1d 100644 --- a/data/rbot/plugins/markov.rb +++ b/data/rbot/plugins/markov.rb @@ -197,7 +197,7 @@ class MarkovPlugin < Plugin def chat(m, params) line = generate_string(params[:seed1], params[:seed2]) if line != "#{params[:seed1]} #{params[:seed2]}" - m.reply line + m.reply line else m.reply "I can't :(" end @@ -221,7 +221,7 @@ class MarkovPlugin < Plugin m.reply "I can't :(" end end - + def message(m) return if ignore? m @@ -231,7 +231,7 @@ class MarkovPlugin < Plugin if m.action? message = "#{m.sourcenick} #{message}" end - + @learning_queue.push message random_markov(m, message) unless m.replied? end diff --git a/data/rbot/plugins/math.rb b/data/rbot/plugins/math.rb index 9dd35c98..081c9c04 100644 --- a/data/rbot/plugins/math.rb +++ b/data/rbot/plugins/math.rb @@ -44,7 +44,7 @@ class MathPlugin < Plugin val = Math.exp($2).to_s expr.gsub!(/#{Regexp.escape exp}/, "+#{val}") end - + while expr =~ /^\s*(dec2hex\s*(\d+))\s*\?*/ exp = $1 val = sprintf("%x", $2) @@ -56,13 +56,13 @@ class MathPlugin < Plugin while expr =~ /(log\s*((\d+\.?\d*)|\d*\.?\d+))\s*/ exp = $1 res = $2 - + if res == 0 val = "Infinity" else val = Math.log(res).to_s end - + expr.gsub!(/#{Regexp.escape exp}/, "+#{val}") end diff --git a/data/rbot/plugins/modes.rb b/data/rbot/plugins/modes.rb index 845c7434..0df78691 100644 --- a/data/rbot/plugins/modes.rb +++ b/data/rbot/plugins/modes.rb @@ -73,7 +73,7 @@ class ModesPlugin < Plugin def do_mode(m, channel, user, mode) unless channel if m.private? - target = user.nil? ? "you" : user + target = user.nil? ? "you" : user m.reply "You should tell me where you want me to #{mode} #{target}." return else diff --git a/data/rbot/plugins/nickrecover.rb b/data/rbot/plugins/nickrecover.rb index ed3c8708..f0277cdf 100644 --- a/data/rbot/plugins/nickrecover.rb +++ b/data/rbot/plugins/nickrecover.rb @@ -11,7 +11,7 @@ # in case it couldn't be achieved. class NickRecoverPlugin < Plugin - + Config.register Config::IntegerValue.new('irc.nick_retry', :default => 60, :valiedate => Proc.new { |v| v >= 0 }, :on_change => Proc.new do |bot, v| diff --git a/data/rbot/plugins/nickserv.rb b/data/rbot/plugins/nickserv.rb index 36333477..768840d3 100644 --- a/data/rbot/plugins/nickserv.rb +++ b/data/rbot/plugins/nickserv.rb @@ -20,7 +20,7 @@ # previously identified successfully class NickServPlugin < Plugin - + Config.register Config::StringValue.new('nickserv.name', :default => "nickserv", :requires_restart => false, :desc => _("Name of the nick server (all lowercase)")) @@ -62,7 +62,7 @@ class NickServPlugin < Plugin return _("nickserv listnicks: lists nicknames and associated password the bot knows about - you will need config level auth access to do this one and it will reply by privmsg only") end end - + def genpasswd return Irc::Bot::Auth.random_password end @@ -167,12 +167,12 @@ class NickServPlugin < Plugin m.reply _("uh ... something went wrong ...") end end - + def connect @identified = false do_identify end - + def nicktaken(nick) if @registry.has_key?(nick) ns_say "GHOST #{nick} #{@registry[nick]}" diff --git a/data/rbot/plugins/nslookup.rb b/data/rbot/plugins/nslookup.rb index 0f901017..a3402711 100644 --- a/data/rbot/plugins/nslookup.rb +++ b/data/rbot/plugins/nslookup.rb @@ -10,7 +10,7 @@ class DnsPlugin < Plugin def help(plugin, topic="") "dns => show local resolution results for hostname or ip address" end - + def name_to_ip(m, params) begin a = getaddresses(params[:host]) @@ -23,7 +23,7 @@ class DnsPlugin < Plugin m.reply "#{params[:host]}: not found" end end - + def ip_to_name(m, params) begin a = gethostname(params[:ip]) diff --git a/data/rbot/plugins/quakeauth.rb b/data/rbot/plugins/quakeauth.rb index 40b91e11..c1a8f9c4 100644 --- a/data/rbot/plugins/quakeauth.rb +++ b/data/rbot/plugins/quakeauth.rb @@ -10,7 +10,7 @@ # Automatically auths with Q on QuakeNet servers class QPlugin < Plugin - + def help(plugin, topic="") case topic when "" @@ -23,7 +23,7 @@ class QPlugin < Plugin return "qauth register : register with Q, an email on how to proceed will be sent to the email address you provide" end end - + def initialize super # this plugin only wants to store strings! @@ -43,7 +43,7 @@ class QPlugin < Plugin @registry['quakenet.auth'] = params[:password] m.okay end - + def connect identify(nil, {}) if on_quakenet? end diff --git a/data/rbot/plugins/quotes.rb b/data/rbot/plugins/quotes.rb index 2a646789..a18f1eba 100644 --- a/data/rbot/plugins/quotes.rb +++ b/data/rbot/plugins/quotes.rb @@ -37,7 +37,7 @@ class QuotePlugin < Plugin if @changed[channel] debug "Writing new quotefile for channel #{channel} ..." Utils.safe_save(datafile channel) {|file| - quotes.compact.each {|q| + quotes.compact.each {|q| file.puts "#{q.num} | #{q.date} | #{q.source} | #{q.quote}" } } @@ -65,7 +65,7 @@ class QuotePlugin < Plugin def addquote(source, channel, quote) @lists[channel] = Array.new if(!@lists.has_key?(channel)) - num = @lists[channel].length + num = @lists[channel].length @lists[channel][num] = Quote.new(num, Time.new, source.fullform, quote) @changed[channel] = true return num diff --git a/data/rbot/plugins/reaction.rb b/data/rbot/plugins/reaction.rb index ee338e2d..55fabcdb 100644 --- a/data/rbot/plugins/reaction.rb +++ b/data/rbot/plugins/reaction.rb @@ -207,7 +207,7 @@ class ReactionPlugin < Plugin "between 0 and 1 (i.e. 0% and 100%). A reaction can have multiple replies, each with a different chance; if the total of the chances is less than one, " + "there is a chance that the trigger will not actually cause a reply. Otherwise, the chances express the relative frequency of the replies." when :trigger, :triggers - "reaction triggers can have one of the format: single_word 'multiple words' \"multiple words \" /regular_expression/ !regular_expression!. " + + "reaction triggers can have one of the format: single_word 'multiple words' \"multiple words \" /regular_expression/ !regular_expression!. " + "If prefixed by 'act:' (e.g. act:/(order|command)s/) the bot will only respond if a CTCP ACTION matches the trigger" when :reply, :replies "reaction replies are simply messages that the bot will reply when a trigger is matched. " + diff --git a/data/rbot/plugins/remind.rb b/data/rbot/plugins/remind.rb index e3f248ef..804e3f0b 100644 --- a/data/rbot/plugins/remind.rb +++ b/data/rbot/plugins/remind.rb @@ -203,11 +203,11 @@ class RemindPlugin < Plugin end def no_more(m, params) who = params.has_key?(:who) ? params[:who] : m.sourcenick - deleted = params.has_key?(:string) ? + deleted = params.has_key?(:string) ? del_reminder(who, params[:string].to_s) : del_reminder(who) if deleted m.okay - else + else m.reply "but I wasn't going to :/" end end diff --git a/data/rbot/plugins/ri.rb b/data/rbot/plugins/ri.rb index 763dd658..abecb6ec 100644 --- a/data/rbot/plugins/ri.rb +++ b/data/rbot/plugins/ri.rb @@ -52,7 +52,7 @@ class RiPlugin < Plugin return m.reply("failed to execute ri") end ret = ret.gsub(/\t/, " ").split(/\n/).join(" ").gsub(/\s\s+/, ' ') - + if ret.length > @bot.config['ri.max_length'] if !m.private? && tgt.to_s != m.sourcenick return m.reply('entry is too long to send to the channel or to some other user, use /msg to ask me about it') diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index 885ae248..bfc700d3 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -16,7 +16,7 @@ require 'rss' -# Try to load rss/content/2.0 so we can access the data in +# Try to load rss/content/2.0 so we can access the data in # tags. begin require 'rss/content/2.0' @@ -293,7 +293,7 @@ class RSSFeedsPlugin < Plugin # Make an 'unique' ID for a given item, based on appropriate bot options # Currently only suppored is bot.config['rss.show_updated']: when false, # only the guid/link is accounted for. - + def make_uid(item) uid = [item.guid! || item.link!] if @bot.config['rss.show_updated'] @@ -1018,7 +1018,7 @@ class RSSFeedsPlugin < Plugin else date = item.source.updated.content.to_s end - elsif item.respond_to?(:pubDate) + elsif item.respond_to?(:pubDate) if item.pubDate.class <= Time date = item.pubDate.strftime("%Y/%m/%d %H:%M") else @@ -1055,7 +1055,7 @@ class RSSFeedsPlugin < Plugin desc_opt[:limit] = @bot.config['rss.text_max'] desc_opt[:a_href] = :link_out if @bot.config['rss.show_links'] - # We prefer content_encoded here as it tends to provide more html formatting + # We prefer content_encoded here as it tends to provide more html formatting # for use with ircify_html. if item.respond_to?(:content_encoded) && item.content_encoded desc = item.content_encoded.ircify_html(desc_opt) diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb index e80a02b0..1c552aab 100644 --- a/data/rbot/plugins/salut.rb +++ b/data/rbot/plugins/salut.rb @@ -15,12 +15,12 @@ class SalutPlugin < Plugin Config.register Config::BooleanValue.new('salut.all_languages', - :default => true, + :default => true, :desc => "Check for a salutation in all languages and not just in the one defined by core.language", :on_change => Proc.new {|bot, v| bot.plugins['salut'].reload} ) Config.register Config::BooleanValue.new('salut.address_only', - :default => true, + :default => true, :desc => "When set to true, the bot will only reply to salutations directed at him", :on_change => Proc.new {|bot, v| bot.plugins['salut'].reload} ) @@ -113,7 +113,7 @@ class SalutPlugin < Plugin return unless salut # If the bot wasn't addressed, we continue only if the match was exact # (apart from space and punctuation) or if @match[:dest] matches too - return unless to_me or m.message =~ /^#{@punct}#{salut.first}#{@punct}$/ or m.message =~ @match[salut[1]][:dest] + return unless to_me or m.message =~ /^#{@punct}#{salut.first}#{@punct}$/ or m.message =~ @match[salut[1]][:dest] h = Time.new.hour case h when 4...12 diff --git a/data/rbot/plugins/script.rb b/data/rbot/plugins/script.rb index 849783b8..0923dd5d 100644 --- a/data/rbot/plugins/script.rb +++ b/data/rbot/plugins/script.rb @@ -11,7 +11,7 @@ # # Scripts are little Ruby programs that run in the context of the script # plugin. You can create them directly in an IRC channel, and invoke them just -# like normal rbot plugins. +# like normal rbot plugins. define_structure :Command, :code, :nick, :created, :channel @@ -64,8 +64,8 @@ class ScriptPlugin < Plugin # Convenience variables, can be accessed by scripts: args = m.message.split - args.delete_at( 0 ) - user = args.empty? ? m.sourcenick : args.first + args.delete_at( 0 ) + user = args.empty? ? m.sourcenick : args.first Thread.start { # TODO allow different safe levels for different botusers @@ -152,7 +152,7 @@ class ScriptPlugin < Plugin def handle_add_force( m, params ) handle_add( m, params, true ) end - + def handle_del( m, params ) name = params[:name] @@ -176,9 +176,9 @@ class ScriptPlugin < Plugin page = params[:page].to_i page = [page, 1].max page = [page, num_pages].min - str = cmds[(page-1)*cmds_per_page, cmds_per_page].join(', ') + str = cmds[(page-1)*cmds_per_page, cmds_per_page].join(', ') - m.reply "Available scripts (page #{page}/#{num_pages}): #{str}" + m.reply "Available scripts (page #{page}/#{num_pages}): #{str}" end diff --git a/data/rbot/plugins/search.rb b/data/rbot/plugins/search.rb index dc0c2ca9..a7ac64cb 100644 --- a/data/rbot/plugins/search.rb +++ b/data/rbot/plugins/search.rb @@ -113,7 +113,7 @@ class SearchPlugin < Plugin def gcalc(m, params) what = params[:words].to_s searchfor = CGI.escape(what) - + debug "Getting gcalc thing: #{searchfor.inspect}" url = GOOGLE_SEARCH + searchfor @@ -125,24 +125,24 @@ class SearchPlugin < Plugin end debug "#{html.size} bytes of html recieved" - + results = html.scan(GOOGLE_CALC_RESULT) debug "results: #{results.inspect}" - + if results.length != 1 m.reply "couldn't calculate #{what}" return end - + result = results[0][0].ircify_html debug "replying with: #{result.inspect}" m.reply "#{result}" end - + def gcount(m, params) what = params[:words].to_s searchfor = CGI.escape(what) - + debug "Getting gcount thing: #{searchfor.inspect}" url = GOOGLE_SEARCH + searchfor @@ -154,15 +154,15 @@ class SearchPlugin < Plugin end debug "#{html.size} bytes of html recieved" - + results = html.scan(GOOGLE_COUNT_RESULT) debug "results: #{results.inspect}" - + if results.length != 1 m.reply "couldn't count #{what}" return end - + result = results[0][0].ircify_html debug "replying with: #{result.inspect}" m.reply "total results: #{result}" @@ -172,7 +172,7 @@ class SearchPlugin < Plugin def gdef(m, params) what = params[:words].to_s searchfor = CGI.escape("define " + what) - + debug "Getting gdef thing: #{searchfor.inspect}" url = GOOGLE_WAP_SEARCH + searchfor @@ -186,12 +186,12 @@ class SearchPlugin < Plugin debug html results = html.scan(GOOGLE_DEF_RESULT) debug "results: #{results.inspect}" - + if results.length != 1 m.reply "couldn't find a definition for #{what} on Google" return end - + head = results[0][0].ircify_html text = results[0][1].ircify_html link = results[0][2] @@ -224,7 +224,7 @@ plugin = SearchPlugin.new plugin.map "search *words", :action => 'google', :threaded => true plugin.map "google *words", :action => 'google', :threaded => true -plugin.map "gcount *words", :action => 'gcount', :threaded => true +plugin.map "gcount *words", :action => 'gcount', :threaded => true plugin.map "gcalc *words", :action => 'gcalc', :threaded => true plugin.map "gdef *words", :action => 'gdef', :threaded => true plugin.map "wp :lang *words", :action => 'wikipedia', :requirements => { :lang => /^\w\w\w?$/ }, :threaded => true diff --git a/data/rbot/plugins/seen.rb b/data/rbot/plugins/seen.rb index ccfdb726..1483062c 100644 --- a/data/rbot/plugins/seen.rb +++ b/data/rbot/plugins/seen.rb @@ -11,7 +11,7 @@ class SeenPlugin < Plugin def help(plugin, topic="") "seen => have you seen, or when did you last see " end - + def privmsg(m) unless(m.params =~ /^(\S)+$/) m.reply "incorrect usage: " + help(m.plugin) @@ -39,7 +39,7 @@ class SeenPlugin < Plugin m.target.to_s, m.message.dup) when QuitMessage return if m.address? - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, now, "QUIT", + @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, now, "QUIT", nil, m.message.dup) when NickMessage return if m.address? @@ -48,23 +48,23 @@ class SeenPlugin < Plugin @registry[m.newnick] = saw when PartMessage return if m.address? - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "PART", + @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "PART", m.target.to_s, m.message.dup) when JoinMessage return if m.address? - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "JOIN", + @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "JOIN", m.target.to_s, m.message.dup) when TopicMessage return if m.address? or m.info_or_set == :info - @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "TOPIC", + @registry[m.sourcenick] = Saw.new(m.sourcenick.dup, Time.new, "TOPIC", m.target.to_s, m.message.dup) end end - + def seen(saw) ret = "#{saw.nick} was last seen " ago = Time.new - saw.time - + if (ago.to_i == 0) ret << "just now, " else @@ -88,7 +88,7 @@ class SeenPlugin < Plugin ret << "changing the topic of #{saw.where} to #{saw.message}" end end - + end plugin = SeenPlugin.new plugin.register("seen") diff --git a/data/rbot/plugins/shortenurls.rb b/data/rbot/plugins/shortenurls.rb index 7eeb005f..3aee6f4d 100644 --- a/data/rbot/plugins/shortenurls.rb +++ b/data/rbot/plugins/shortenurls.rb @@ -15,7 +15,7 @@ require "shorturl" require "uri" class ShortenURLs < Plugin - # starting from about shorturl 0.8.4, the WWW module is not defined + # starting from about shorturl 0.8.4, the WWW module is not defined include WWW rescue nil Config.register Config::ArrayValue.new('shortenurls.services_blacklist', diff --git a/data/rbot/plugins/slashdot.rb b/data/rbot/plugins/slashdot.rb index 5b3c2f3b..69f1566f 100644 --- a/data/rbot/plugins/slashdot.rb +++ b/data/rbot/plugins/slashdot.rb @@ -62,7 +62,7 @@ class SlashdotPlugin < Plugin @bot.register_filter(:slashdot, :htmlinfo) { |s| slashdot_filter(s) } end end - + def search_slashdot(m, params) max = params[:limit].to_i search = params[:search].to_s @@ -99,7 +99,7 @@ class SlashdotPlugin < Plugin m.reply "search for #{search} failed" end end - + def slashdot(m, params) debug params.inspect max = params[:limit].to_i @@ -123,12 +123,12 @@ class SlashdotPlugin < Plugin max = 8 if max > 8 matches = Array.new doc.elements.each("*/story") {|e| - matches << [ e.elements["title"].text, - e.elements["author"].text, + matches << [ e.elements["title"].text, + e.elements["author"].text, e.elements["time"].text.gsub(/\d{4}-(\d{2})-(\d{2})/, "\\2/\\1").gsub(/:\d\d$/, "") ] done += 1 break if done >= max - } + } if oneline m.reply matches.collect{|mat| mat[0]}.join(" | ") else diff --git a/data/rbot/plugins/theyfightcrime.rb b/data/rbot/plugins/theyfightcrime.rb index e0a29013..866c0600 100644 --- a/data/rbot/plugins/theyfightcrime.rb +++ b/data/rbot/plugins/theyfightcrime.rb @@ -1,21 +1,21 @@ HE = [ ['a superhumanly strong','an underprivileged','a globe-trotting','an impetuous','a shy','a suave','a notorious','a one-legged','an all-American','a short-sighted','an otherworldly','a hate-fuelled','a scrappy','an unconventional','a jaded','a leather-clad','a fiendish','a Nobel prize-winning','a suicidal','a maverick','a bookish','an old-fashioned','a witless','a lounge-singing','a war-weary','a scarfaced','a gun-slinging','an obese','a time-tossed','a benighted','an uncontrollable','an immortal','an oversexed','a world-famous','an ungodly','a fast talking','a deeply religious','a lonely','a sword-wielding','a genetically engineered'], - + ['white trash','zombie','shark-wrestling','playboy','guitar-strumming','Jewish', 'sweet-toothed','bohemian','crooked','chivalrous','moralistic','amnesiac','devious','drug-addicted', 'voodoo','Catholic','overambitious','coffee-fuelled','pirate','misogynist','skateboarding', 'arachnophobic','Amish','small-town','Republican','one-eyed','gay','guerilla','vegetarian', 'dishevelled','alcoholic','flyboy','ninja','albino','hunchbacked','neurotic','umbrella-wielding', 'native American','soccer-playing','day-dreaming'], - + ['grifter','stage actor','paramedic','gentleman spy','jungle king','hairdresser', 'photographer','ex-con','vagrant','filmmaker','werewolf','senator','romance novelist','shaman','cop', 'rock star','farmboy','cat burglar','cowboy','cyborg','inventor','assassin','boxer','dog-catcher', 'master criminal','gangster','firefighter','househusband','dwarf','librarian','paranormal investigator', 'Green Beret','waffle chef','vampire hunter','messiah','astronaut','sorceror','card sharp','matador', 'barbarian'], - + ['with a robot buddy named Sparky','whom everyone believes is mad','gone bad', 'with a mysterious suitcase handcuffed to his arm','living undercover at Ringling Bros. Circus', 'searching for his wife''s true killer','who dotes on his loving old ma','looking for ''the Big One''', @@ -42,19 +42,19 @@ SHE = [ 'a plucky','a sarcastic','a psychotic','a hard-bitten','a manipulative','an orphaned','a cosmopolitan', 'a chain-smoking','a cold-hearted','a warm-hearted','a sharp-shooting','an enchanted','a wealthy','a pregnant', 'a mentally unstable','a virginal','a brilliant','a disco-crazy','a provocative','an artistic'], - + ['tempestuous', 'Buddhist', 'foul-mouthed', 'nymphomaniac', 'green-skinned', 'impetuous', 'African-American','punk','hypochondriac','junkie','blonde','goth','insomniac','gypsy','mutant','renegade', 'tomboy','French-Canadian','motormouth','belly-dancing','communist','hip-hop','thirtysomething', 'cigar-chomping','extravagent','out-of-work','Bolivian','mute','cat-loving','snooty','wisecracking', 'red-headed','winged','kleptomaniac','antique-collecting','psychic','gold-digging','bisexual','paranoid', 'streetsmart'], - + ['archaeologist','pearl diver','mechanic','detective','hooker','femme fatale', 'former first lady','barmaid','fairy princess','magician''s assistant','schoolgirl','college professor', 'angel','bounty hunter','opera singer','cab driver','soap star','doctor','politician','lawyer','nun', 'snake charmer','journalist','bodyguard','vampire','stripper','Valkyrie','wrestler','mermaid','single mother', 'safe cracker','traffic cop','research scientist','queen of the dead','Hell''s Angel','museum curator', 'advertising executive','widow','mercenary','socialite'], - + ['on her way to prison for a murder she didn''t commit','trying to make a difference in a man''s world', 'with the soul of a mighty warrior','looking for love in all the wrong places','with an MBA from Harvard', 'who hides her beauty behind a pair of thick-framed spectacles','with the power to see death', @@ -80,14 +80,14 @@ TITLE = [ 'BLOOD', 'HARD', 'STEEL', 'TERMINAL', 'HOT', 'COLD', 'TOTAL', 'PROGNOSIS:', 'BURNING', 'FAST', 'PAINFUL', 'MISSION:', 'DEADLY', 'PARTIAL', 'RAGING', 'CORDIAL'], - + ['DECISION', 'INCISION', 'CONCLUSION', 'CONCUSSION', 'HEAT', 'FIRE', 'RECOIL', 'INSTINCT', 'DESIRE', 'WEAPON', 'BADGE', 'DEED', 'JUSTICE', 'HEAT', 'VENGEANCE', 'RECESSION', 'COMBUSTION', 'JUDGEMENT', 'WARNING', 'AWAKENING', 'JURISDICTION', 'BASIS', 'FINDINGS', 'INJECTION', 'REJECTION', 'REMISSION', 'DIGESTION', 'IDENTITY', 'DISPERSION'], - + ['II','III','IV','V','VI','VII','VIII','IX','X','XI','XII','XIII','XIV','XV','XVI','XVII','XVIII','XIX'] ] @@ -96,11 +96,11 @@ class TheyFightCrime < Plugin def help(plugin, topic="") "movieplot => generate a random movie scenario. movietitle => generate a random movie title." end - + def get_random_things(thing_array) thing_array.map { |things| things.pick_one } end - + def movieplot(m, params) he_things = get_random_things(HE) she_things = get_random_things(SHE) diff --git a/data/rbot/plugins/time.rb b/data/rbot/plugins/time.rb index 4e7543c8..190abd6a 100644 --- a/data/rbot/plugins/time.rb +++ b/data/rbot/plugins/time.rb @@ -45,13 +45,13 @@ class TimePlugin < Plugin end ['/', '_'].each { |sp| arr = Array.new - zone.split(sp).each{ |s| + zone.split(sp).each{ |s| s[0] = s[0,1].upcase s[1, s.length] = s[1, s.length].downcase if sp == '/' arr.push(s) } zone = arr.join( sp ) } - + tz = TZInfo::Timezone.get( zone ) "#{tz.friendly_identifier} - #{tz.now.strftime( '%a %b %d %H:%M' )} #{tz.current_period.abbreviation}" end diff --git a/data/rbot/plugins/translator.rb b/data/rbot/plugins/translator.rb index ad9c431c..0e09cb48 100644 --- a/data/rbot/plugins/translator.rb +++ b/data/rbot/plugins/translator.rb @@ -39,7 +39,7 @@ class Translator @cache = cache end - + # whether the translator supports this direction def support?(from, to) from != to && @directions[from].include?(to) @@ -316,7 +316,7 @@ class TranslatorPlugin < Plugin end def update_default - @default_translators = bot.config['translator.default_list'] & @translators.keys + @default_translators = bot.config['translator.default_list'] & @translators.keys end def cmd_translator(m, params) diff --git a/data/rbot/plugins/tube.rb b/data/rbot/plugins/tube.rb index 13805502..bbae5c59 100644 --- a/data/rbot/plugins/tube.rb +++ b/data/rbot/plugins/tube.rb @@ -5,7 +5,7 @@ class TubePlugin < Plugin def help(plugin, topic="") "tube [district|circle|metropolitan|central|jubilee|bakerloo|waterlooandcity|hammersmithandcity|victoria|eastlondon|northern|piccadilly] => display tube service status for the specified line(Docklands Light Railway is not currently supported)" # , tube stations => list tube stations (not lines) with problems" end - + def tube(m, params) line = params[:line] tube_page = @bot.httputil.get('http://www.tfl.gov.uk/tfl/livetravelnews/realtime/tube/default.html') @@ -45,7 +45,7 @@ class TubePlugin < Plugin stations_array.push $1 end } - if stations_array.empty? + if stations_array.empty? m.reply "There are no station-specific announcements" return else diff --git a/data/rbot/plugins/weather.rb b/data/rbot/plugins/weather.rb index 5da949e4..d8f7579c 100644 --- a/data/rbot/plugins/weather.rb +++ b/data/rbot/plugins/weather.rb @@ -71,18 +71,18 @@ class WeatherPlugin < Plugin Config.register Config::BooleanValue.new('weather.advisory', :default => true, :desc => "Should the bot report special weather advisories when any is present?") - + def help(plugin, topic="") case topic when "nws" "weather nws => display the current conditions at the location specified by the NOAA National Weather Service station code ( lookup your station code at http://www.nws.noaa.gov/data/current_obs/ )" when "station", "wu" - "weather [] => display the current conditions at the location specified, looking it up on the Weather Underground site; you can use 'station ' to look up data by station code ( lookup your station code at http://www.weatherunderground.com/ ); you can optionally set to 'metric' or 'english' if you only want data with the units; use 'both' for units to go back to having both." + "weather [] => display the current conditions at the location specified, looking it up on the Weather Underground site; you can use 'station ' to look up data by station code ( lookup your station code at http://www.weatherunderground.com/ ); you can optionally set to 'metric' or 'english' if you only want data with the units; use 'both' for units to go back to having both." else "weather information lookup. Looks up weather information for the last location you specified. See topics 'nws' and 'wu' for more information" end end - + def initialize super @@ -91,7 +91,7 @@ class WeatherPlugin < Plugin @wu_url = "http://mobile.wunderground.com/cgi-bin/findweather/getForecast?brand=mobile%s&query=%s" @wu_station_url = "http://mobile.wunderground.com/auto/mobile%s/global/stations/%s.html" end - + def weather(m, params) if params[:where].empty? if @registry.has_key?(m.sourcenick) diff --git a/data/rbot/plugins/wserver.rb b/data/rbot/plugins/wserver.rb index a888ad0c..b9260170 100644 --- a/data/rbot/plugins/wserver.rb +++ b/data/rbot/plugins/wserver.rb @@ -12,20 +12,20 @@ class WserverPlugin < Plugin m.reply "cowardly refusing to follow more than 3 redirects" return end - + begin uri = URI.parse(hostname) rescue URI::InvalidURIError => err m.reply "#{hostname} is not a valid URI" return end - + unless(uri) m.reply "incorrect usage: " + help(m.plugin) return end - - + + resp = @bot.httputil.head(uri) server = resp['Server'] if(server && server.length > 0) @@ -34,7 +34,7 @@ class WserverPlugin < Plugin m.reply "couldn't tell what #{uri.host} is running" end - if(resp.code == "302" || resp.code == "301") + if(resp.code == "302" || resp.code == "301") newloc = resp['location'] newuri = URI.parse(newloc) # detect and ignore incorrect redirects (to relative paths etc) diff --git a/lib/rbot/botuser.rb b/lib/rbot/botuser.rb index a4bec708..f7e41d97 100644 --- a/lib/rbot/botuser.rb +++ b/lib/rbot/botuser.rb @@ -24,7 +24,7 @@ require 'rbot/maskdb' # } # } # end -# +# module Irc class Bot diff --git a/lib/rbot/core/basics.rb b/lib/rbot/core/basics.rb index 3fc794bc..832cbb25 100644 --- a/lib/rbot/core/basics.rb +++ b/lib/rbot/core/basics.rb @@ -190,7 +190,7 @@ basics.map "mode :where :what *who", :action => 'bot_mode', :auth_path => 'talk::do' -basics.map "join :chan :pass", +basics.map "join :chan :pass", :action => 'bot_join', :defaults => {:pass => nil}, :auth_path => 'move' diff --git a/lib/rbot/core/filters_ui.rb b/lib/rbot/core/filters_ui.rb index 2ac258d6..31e35452 100644 --- a/lib/rbot/core/filters_ui.rb +++ b/lib/rbot/core/filters_ui.rb @@ -27,7 +27,7 @@ class FiltersModule < CoreBotModule msg = _("no known filters") end else - msg = _("known filters: ") << ar.join(", ") + msg = _("known filters: ") << ar.join(", ") end m.reply msg end @@ -37,7 +37,7 @@ class FiltersModule < CoreBotModule if ar.empty? msg = _("no known filter groups") else - msg = _("known filter groups: ") << ar.join(", ") + msg = _("known filter groups: ") << ar.join(", ") end m.reply msg end diff --git a/lib/rbot/core/irclog.rb b/lib/rbot/core/irclog.rb index b848947c..40266772 100644 --- a/lib/rbot/core/irclog.rb +++ b/lib/rbot/core/irclog.rb @@ -153,7 +153,7 @@ class IrcLogModule < CoreBotModule irclog "@ #{m.source} asked #{who} about #{[m.ctcp, m.message].join(' ')}", logtarget end else - if m.public? + if m.public? irclog "<#{m.source}> #{m.logmessage}", m.target else irclog "<#{m.source}(#{m.sourceaddress})> #{m.logmessage}", m.source diff --git a/lib/rbot/core/remote.rb b/lib/rbot/core/remote.rb index 7157195f..2d39d769 100644 --- a/lib/rbot/core/remote.rb +++ b/lib/rbot/core/remote.rb @@ -147,7 +147,7 @@ class Bot # # Presently, the hash returned on success has only one key, :return, whose # value is the actual return value of the successfull dispatch. - # + # # TODO this same kind of mechanism could actually be used in MessageMapper # itself to be able to handle the case of multiple plugins having the same # 'first word' ... diff --git a/lib/rbot/core/userdata.rb b/lib/rbot/core/userdata.rb index 2b142bee..ced5c1e7 100644 --- a/lib/rbot/core/userdata.rb +++ b/lib/rbot/core/userdata.rb @@ -25,7 +25,7 @@ module ::Irc # # If you have to do large-scale editing of the Bot data Hash, # please use with_botdata. - # + # def set_botdata(key, value=nil, &block) Irc::Utils.bot.plugins['userdata'].set_data(self, key, value, &block) end diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/core/utils/httputil.rb index 68e00ba5..4ea83104 100644 --- a/lib/rbot/core/utils/httputil.rb +++ b/lib/rbot/core/utils/httputil.rb @@ -99,7 +99,7 @@ module ::Net end when 'deflate' debug "inflating body" - # From http://www.koders.com/ruby/fid927B4382397E5115AC0ABE21181AB5C1CBDD5C17.aspx?s=thread: + # From http://www.koders.com/ruby/fid927B4382397E5115AC0ABE21181AB5C1CBDD5C17.aspx?s=thread: # -MAX_WBITS stops zlib from looking for a zlib header inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) begin diff --git a/lib/rbot/core/utils/utils.rb b/lib/rbot/core/utils/utils.rb index 8df9626c..77bdeecf 100644 --- a/lib/rbot/core/utils/utils.rb +++ b/lib/rbot/core/utils/utils.rb @@ -287,13 +287,13 @@ module ::Irc _("%{m} minutes") % { :m => secs/SEC_PER_MIN } when secs > 1 _("%{m} seconds") % { :m => secs } - else + else _("one second") end end # Execute an external program, returning a String obtained by redirecting - # the program's standards errors and output + # the program's standards errors and output # def Utils.safe_exec(command, *args) IO.popen("-") { |p| diff --git a/lib/rbot/dbhash.rb b/lib/rbot/dbhash.rb index 704dafae..8b128f1b 100644 --- a/lib/rbot/dbhash.rb +++ b/lib/rbot/dbhash.rb @@ -75,7 +75,7 @@ module Irc def DBHash.create_db(name) debug "DBHash: creating empty db #{name}" - return BDB::Hash.open(name, nil, + return BDB::Hash.open(name, nil, BDB::CREATE | BDB::EXCL, 0600) end diff --git a/lib/rbot/irc.rb b/lib/rbot/irc.rb index 81ea43c6..4c462bb3 100644 --- a/lib/rbot/irc.rb +++ b/lib/rbot/irc.rb @@ -33,7 +33,7 @@ class Object # We alias the to_s method to __to_s__ to make # it accessible in all classes - alias :__to_s__ :to_s + alias :__to_s__ :to_s end # The Irc module is used to keep all IRC-related classes @@ -542,7 +542,7 @@ class Regexp GEN_HOST = /#{HOSTNAME}|#{HOSTADDR}/ # # FreeNode network replaces the host of affiliated users with - # # 'virtual hosts' + # # 'virtual hosts' # # FIXME we need the true syntax to match it properly ... # PDPC_HOST_PART = /[0-9A-Za-z.-]+/ # PDPC_HOST = /#{PDPC_HOST_PART}(?:\/#{PDPC_HOST_PART})+/ @@ -550,7 +550,7 @@ class Regexp # # NOTE: the final optional and non-greedy dot is needed because some # # servers (e.g. FreeNode) send the hostname of the services as "services." # # which is not RFC compliant, but sadly done. - # GEN_HOST_EXT = /#{PDPC_HOST}|#{GEN_HOST}\.??/ + # GEN_HOST_EXT = /#{PDPC_HOST}|#{GEN_HOST}\.??/ # Sadly, different networks have different, RFC-breaking ways of cloaking # the actualy host address: see above for an example to handle FreeNode. @@ -1350,7 +1350,7 @@ module Irc # Adds a user to the channel # def add_user(user, opts={}) - silent = opts.fetch(:silent, false) + silent = opts.fetch(:silent, false) if has_user?(user) warn "Trying to add user #{user} to channel #{self} again" unless silent else diff --git a/lib/rbot/language.rb b/lib/rbot/language.rb index 67114dac..cb083244 100644 --- a/lib/rbot/language.rb +++ b/lib/rbot/language.rb @@ -57,16 +57,16 @@ class Bot return 'english' end - Config.register Config::EnumValue.new('core.language', + Config.register Config::EnumValue.new('core.language', :default => Irc::Bot::Language.from_locale, :wizard => true, :values => Proc.new{|bot| Dir.new(Config::datadir + "/languages").collect {|f| f =~ /\.lang$/ ? f.gsub(/\.lang$/, "") : nil }.compact - }, + }, :on_change => Proc.new {|bot, v| bot.lang.set_language v}, :desc => "Which language file the bot should use") - + def initialize(bot, language) @bot = bot set_language language diff --git a/lib/rbot/message.rb b/lib/rbot/message.rb index 4da511ed..64c4b6bb 100644 --- a/lib/rbot/message.rb +++ b/lib/rbot/message.rb @@ -86,7 +86,7 @@ module Irc data end if ColorCode.key?(f) - ColorCode[f] + ColorCode[f] else 0 end diff --git a/lib/rbot/messagemapper.rb b/lib/rbot/messagemapper.rb index b6125538..9501ac59 100644 --- a/lib/rbot/messagemapper.rb +++ b/lib/rbot/messagemapper.rb @@ -144,7 +144,7 @@ class Bot # threaded:: # a boolean (defaults to false) that determines whether the action should be # called in a separate thread. - # + # # # Further examples: # diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb index 9d5523e4..e099e18e 100644 --- a/lib/rbot/plugins.rb +++ b/lib/rbot/plugins.rb @@ -198,7 +198,7 @@ module Plugins @priority ||= 1 end - # Returns the symbol :BotModule + # Returns the symbol :BotModule def botmodule_class :BotModule end @@ -318,7 +318,7 @@ module Plugins # # This command is now superceded by the #map() command, which should be used # instead whenever possible. - # + # def register(cmd, opts={}) raise ArgumentError, "Second argument must be a hash!" unless opts.kind_of?(Hash) who = @manager.who_handles?(cmd) @@ -341,7 +341,7 @@ module Plugins m.reply(_("incorrect usage, ask for help using '%{command}'") % {:command => "#{@bot.nick}: help #{m.plugin}"}) end - # Define the priority of the module. During event delegation, lower + # Define the priority of the module. During event delegation, lower # priority modules will be called first. Default priority is 1 def priority=(prio) if @priority != prio @@ -812,7 +812,7 @@ module Plugins end def sort_modules - @sorted_modules = (core_modules + plugins).sort do |a, b| + @sorted_modules = (core_modules + plugins).sort do |a, b| a.priority <=> b.priority end || [] diff --git a/lib/rbot/timer.rb b/lib/rbot/timer.rb index aafa9be2..8e2a6a4a 100644 --- a/lib/rbot/timer.rb +++ b/lib/rbot/timer.rb @@ -62,7 +62,7 @@ class Timer @repeat = opts[:repeat] if opts.include? :repeat if block_given? - @block = block + @block = block elsif opts[:code] @block = opts[:code] end diff --git a/msgmerge-wrapper.rb b/msgmerge-wrapper.rb index 975107e3..cbc31510 100755 --- a/msgmerge-wrapper.rb +++ b/msgmerge-wrapper.rb @@ -10,7 +10,7 @@ # The purpose is to provide a workaround for ruby-gettext, which treats empty output # from msgmerge as error in the po file, where it should mean that no modification # is needed to the defpo. For updates on the issue follow -# http://rubyforge.org/pipermail/gettext-users-en/2008-June/000094.html +# http://rubyforge.org/pipermail/gettext-users-en/2008-June/000094.html msgmerge = ENV['REAL_MSGMERGE_PATH'] || 'msgmerge' diff --git a/setup.rb b/setup.rb index 994db25e..277accc6 100755 --- a/setup.rb +++ b/setup.rb @@ -660,7 +660,7 @@ module FileOperations def ruby(*args) command config('rubyprog'), *args end - + def make(task = nil) command(*[config('makeprog'), task].compact) end @@ -723,7 +723,7 @@ module HookScriptAPI def srcdirectory?(path) File.dir?(srcfile(path)) end - + def srcfile?(path) File.file?(srcfile(path)) end @@ -827,7 +827,7 @@ class ToplevelInstaller __send__ "exec_#{task}" end end - + def run_metaconfigs @config.load_script "#{@ardir}/metaconfig" end @@ -1405,7 +1405,7 @@ class Installer end # picked up many entries from cvs-1.11.1/src/ignore.c - JUNK_FILES = %w( + JUNK_FILES = %w( core RCSLOG tags TAGS .make.state .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb *~ *.old *.bak *.BAK *.orig *.rej _$* *$ diff --git a/test/test_plugins_priority.rb b/test/test_plugins_priority.rb index b5d3450f..ab66a62d 100644 --- a/test/test_plugins_priority.rb +++ b/test/test_plugins_priority.rb @@ -46,7 +46,7 @@ class PluginsPriorityTest < Test::Unit::TestCase @mock3 = MockModule.new(3) @mock4 = MockModule.new(4) @mock5 = MockModule.new(5) - + # This whole thing is a PITA because PluginManagerClass is a singleton unless @@manager @@manager = PluginManagerClass.instance @@ -63,7 +63,7 @@ class PluginsPriorityTest < Test::Unit::TestCase @@manager.instance_eval { @sort_call_count = nil } @@manager.mark_priorities_dirty - # We add the modules to the lists in the wrong order + # We add the modules to the lists in the wrong order # on purpose to make sure the sort is working @@manager.plugins.clear @@manager.core_modules.clear @@ -81,7 +81,7 @@ class PluginsPriorityTest < Test::Unit::TestCase dlist << @mock2 dlist << @mock5 end - + def test_default_priority plugin = TestRealBotModule.new assert_equal 1, plugin.priority diff --git a/test/test_plugins_threshold.rb b/test/test_plugins_threshold.rb index f8c64a4a..8e92a095 100644 --- a/test/test_plugins_threshold.rb +++ b/test/test_plugins_threshold.rb @@ -55,7 +55,7 @@ class PluginsPriorityTest < Test::Unit::TestCase @mock3 = MockModule.new(3) @mock4 = MockModule.new(4) @mock5 = MockModule.new(5) - + # This whole thing is a PITA because PluginManagerClass is a singleton unless @@manager @@manager = PluginManagerClass.instance @@ -73,7 +73,7 @@ class PluginsPriorityTest < Test::Unit::TestCase @@manager.instance_eval { @sort_call_count = nil } @@manager.mark_priorities_dirty - # We add the modules to the lists in the wrong order + # We add the modules to the lists in the wrong order # on purpose to make sure the sort is working @@manager.plugins.clear @@manager.core_modules.clear @@ -91,7 +91,7 @@ class PluginsPriorityTest < Test::Unit::TestCase dlist << @mock2 dlist << @mock5 end - + def test_above @@manager.delegate_event('test', :above => 3) @@ -101,7 +101,7 @@ class PluginsPriorityTest < Test::Unit::TestCase assert_equal 1, @mock4.test_called_at.size assert_equal 1, @mock5.test_called_at.size end - + def test_below @@manager.delegate_event('test', :below => 3) -- 2.39.2