diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-09 06:44:57 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-09 06:44:57 +0000 |
commit | 17bbbbc1dfd32f0914ca1c5472a1268df3673b27 (patch) | |
tree | 4a4fa77ce94bb4d72e32c066157a75802f54e23d /data/rbot | |
parent | 9c6be0ed315a53cd7d9a10e4c682f94afabd6c3d (diff) |
fortune plugin: suppress warning and make source more readable
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/fortune.rb | 8 |
1 files changed, 7 insertions, 1 deletions
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 |