aboutsummaryrefslogtreecommitdiffstats
path: root/sample/rss/rss_recent.rb
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-17 10:13:25 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-03-17 10:13:25 +0000
commit966a25465aab5c2972e6c453f631a15fc2223256 (patch)
tree847090e856c9901ab2cc19251c179b9b0985e65b /sample/rss/rss_recent.rb
parent53cbab048452742b537ac8bccf494630d1c184c8 (diff)
downloadruby-966a25465aab5c2972e6c453f631a15fc2223256.tar.gz
* lib/rss, test/rss:
- supported Atom. - bumped version 0.1.6 to 0.1.7. * sample/rss/convert.rb: added new sample. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12087 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample/rss/rss_recent.rb')
-rwxr-xr-x[-rw-r--r--]sample/rss/rss_recent.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/sample/rss/rss_recent.rb b/sample/rss/rss_recent.rb
index 7821df5c7b..1b02835ad1 100644..100755
--- a/sample/rss/rss_recent.rb
+++ b/sample/rss/rss_recent.rb
@@ -55,16 +55,19 @@ ARGV.each do |fname|
rescue RSS::UnknownConversionMethodError
error($!) if verbose
end
- rss.items.each do |item|
- if item.respond_to?(:pubDate) and item.pubDate
- class << item
- alias_method(:dc_date, :pubDate)
- end
- end
- if item.respond_to?(:dc_date) and item.dc_date
- items << [rss.channel, item]
+
+ rss = rss.to_rss("1.0") do |maker|
+ maker.channel.about ||= maker.channel.link
+ maker.channel.description.content ||= "No description"
+ maker.items.each do |item|
+ item.link ||= "UNKNOWN"
end
end
+ next if rss.nil?
+
+ rss.items.each do |item|
+ items << [rss.channel, item] if item.dc_date
+ end
end
end
processing_time = Time.now - before_time