]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/slashdot.rb
plugin(oxford): fix empty service result see #37
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / slashdot.rb
index 5b3c2f3bd367f1fb10e691a2c4f3fb4e740da7a9..2c4a23618b8c91d8f551f53e2dd13b855c9befb5 100644 (file)
@@ -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
@@ -75,9 +75,9 @@ class SlashdotPlugin < Plugin
     debug xml.inspect
     begin
       doc = Document.new xml
-    rescue REXML::ParseException => e
-      warning e.inspect
-      m.reply "couldn't parse output XML: #{e.class}"
+    rescue REXML::ParseException => err
+      warning err.inspect
+      m.reply "couldn't parse output XML: #{err.class}"
       return
     end
     unless doc
@@ -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