diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-10-18 22:40:59 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-10-18 22:40:59 +0000 |
commit | 41154292efa3b510f605143455fc3836c05e9750 (patch) | |
tree | f289ca1111d683aea564010ae77237110fd467a9 | |
parent | c36e4355b60dfc02aaf73bb1b7e7a9c82bd59cb7 (diff) |
Fix the no-date bug the right way
-rw-r--r-- | data/rbot/plugins/rss.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/data/rbot/plugins/rss.rb b/data/rbot/plugins/rss.rb index 7d926604..be7a3271 100644 --- a/data/rbot/plugins/rss.rb +++ b/data/rbot/plugins/rss.rb @@ -229,15 +229,15 @@ class RSSFeedsPlugin < Plugin end
def itemDate(item,ex=nil)
- return item.pubDate if item.respond_to?(:pubDate)
- return item.date if item.respond_to?(:date)
+ return item.pubDate if item.respond_to?(:pubDate) and item.pubDate
+ return item.date if item.respond_to?(:date) and item.date
return ex
end
def freshness_sort(items)
notime = Time.at(0)
items.sort { |a, b|
- itemDate(b, notime) || 0 <=> itemDate(a, notime) || 0
+ itemDate(b, notime) <=> itemDate(a, notime)
}
end
|