mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 17:43:59 +02:00
* lib/rss/rss.rb (Hash#merge, Enumerable#sort_by): removed.
* lib/rss/rss.rb (RSS::RootElementMixin#to_xml): added. [ruby-talk:197284] We can convert RSS version easily like the following: rss10 = RSS::Parser.parse(File.read("1.0.rdf")) File.open("2.0.rss", "w") {|f| f.print(rss10.to_xml("2.0"))} * test/rss/test_1.0.rb: added #to_xml test. * test/rss/test_2.0.rb: ditto. * test/rss/rss-testcase.rb: added some helper methods that generates sample RSS 2.0. * sample/rss/convert.rb: added a sample script to convert RSS format. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
02cce7ed82
commit
faeff623e0
7 changed files with 150 additions and 25 deletions
|
@ -373,7 +373,20 @@ module RSS
|
|||
end
|
||||
assert_equal(source_params, actual)
|
||||
end
|
||||
|
||||
|
||||
def test_to_xml
|
||||
rss = RSS::Parser.parse(make_sample_rss20)
|
||||
assert_equal(rss.to_s, rss.to_xml)
|
||||
assert_equal(rss.to_s, rss.to_xml("2.0"))
|
||||
rss09 = RSS::Parser.parse(rss.to_xml("0.91"))
|
||||
assert_equal("0.91", rss09.rss_version)
|
||||
rss10 = rss.to_xml("1.0") do |maker|
|
||||
maker.channel.about = "http://www.example.com/index.rdf"
|
||||
end
|
||||
rss10 = RSS::Parser.parse(rss10)
|
||||
assert_equal("1.0", rss10.rss_version)
|
||||
end
|
||||
|
||||
def test_indent_size
|
||||
assert_equal(0, Rss.indent_size)
|
||||
assert_equal(1, Rss::Channel.indent_size)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue