From 07eb740efe5172ed3c9a8fad84088d26d539da01 Mon Sep 17 00:00:00 2001 From: kou Date: Wed, 7 Apr 2004 03:36:38 +0000 Subject: * lib/rss/parser.rb, lib/rss/1.0.rb: accepted rdf:resource or resource attribute in rdf:li. * test/rss/test_parser.rb: added test for above change. * lib/rss/dublincore.rb: reverted style. * lib/rss/xmlparser.rb: normalized XMLParser class hierarchy. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/rss/list_description.rb | 10 +++++----- sample/rss/rss_recent.rb | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'sample') diff --git a/sample/rss/list_description.rb b/sample/rss/list_description.rb index edb9ba07a..e0b59ea65 100644 --- a/sample/rss/list_description.rb +++ b/sample/rss/list_description.rb @@ -10,7 +10,6 @@ class String end end -require "rss/parser" require "rss/1.0" require "rss/2.0" require "rss/dublincore" @@ -72,13 +71,14 @@ processing_time = Time.now - before_time channels.sort do |x, y| x[0] <=> y[0] end[0..20].each do |title, items| - puts "Channel : #{title}" unless items.empty? + puts "Channel: #{title}" unless items.empty? items.sort do |x, y| x.title <=> y.title end[0..10].each do |item| - puts " Item : #{item.title.shorten(50)}" - puts " Description : #{item.description.shorten(50)}" + puts " Item: #{item.title.shorten(50)}" + puts " Description: #{item.description.shorten(50)}" end end -puts "Processing Time : #{processing_time}s" +puts "Used XML parser: #{RSS::Parser.default_parser}" +puts "Processing time: #{processing_time}s" diff --git a/sample/rss/rss_recent.rb b/sample/rss/rss_recent.rb index 3ccb4a450..8e40151e1 100644 --- a/sample/rss/rss_recent.rb +++ b/sample/rss/rss_recent.rb @@ -10,10 +10,8 @@ class String end end -require "rss/parser" require "rss/1.0" require "rss/2.0" -require "rss/syndication" require "rss/dublincore" items = [] @@ -76,9 +74,10 @@ processing_time = Time.now - before_time items.sort do |x, y| y[1].dc_date <=> x[1].dc_date end[0..20].each do |channel, item| - puts "#{item.dc_date.localtime.iso8601} : " << - "#{channel.title} : #{item.title}" - puts " description : #{item.description.shorten(50)}" if item.description + puts "#{item.dc_date.localtime.iso8601}: " << + "#{channel.title}: #{item.title}" + puts " Description: #{item.description.shorten(50)}" if item.description end -puts "Processing Time : #{processing_time}s" +puts "Used XML parser: #{RSS::Parser.default_parser}" +puts "Processing time: #{processing_time}s" -- cgit