From 17bbbbc1dfd32f0914ca1c5472a1268df3673b27 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 9 Sep 2007 06:44:57 +0000 Subject: fortune plugin: suppress warning and make source more readable --- data/rbot/plugins/fortune.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/data/rbot/plugins/fortune.rb b/data/rbot/plugins/fortune.rb index 467d452d..d258e9ba 100644 --- a/data/rbot/plugins/fortune.rb +++ b/data/rbot/plugins/fortune.rb @@ -66,7 +66,13 @@ class FortunePlugin < Plugin # Print the fortune categories def categories(m, params) ## list all fortune files in /usr/share/games/fortune - categories = Dir["/usr/share/games/fortune/*"].select{|f|File.split(f).last.match /^\w+$/}.select{|f|File.file? f}.map{|p|File.split(p).last}.sort + categories = Dir["/usr/share/games/fortune/*"].select{ |f| + File.split(f).last.match(/^\w+$/) + }.select{ |f| + File.file?(f) + }.map{ |p| + File.split(p).last + }.sort ## say 'em! m.reply "Fortune categories: #{categories.join ', '}" end -- cgit v1.2.3