diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-04-19 11:39:18 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-04-19 11:39:18 +0200 |
commit | 087ff14d6117ef746bfad797a8088a7e6b74d5ac (patch) | |
tree | 308fadc42f93f3598f3be2594388723f21743a54 /data/rbot/plugins/rss.rb | |
parent | 93314b5143834ec51d5b8f118ef343b59203c130 (diff) |
rss plugin: return from select_nonempty() as soon as nonempty is found
Don't map over all parameters, because some parameters might not respond
to empty?. Also, it's unnecessarily slow. Just return as soon as we
found a nonempty parameter.
Diffstat (limited to 'data/rbot/plugins/rss.rb')
-rw-r--r-- | data/rbot/plugins/rss.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index 1d141f3b..ae2c0233 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -938,8 +938,8 @@ class RSSFeedsPlugin < Plugin def select_nonempty(*ar) debug ar - ret = ar.map { |i| (i && i.empty?) ? nil : i }.compact.first - (ret && ret.empty?) ? nil : ret + ar.each { |i| return i unless i.nil_or_empty? } + return nil end def printFormattedRss(feed, item, opts=nil) |