[前][次][番号順一覧][スレッド一覧]

ruby-changes:11808

From: kou <ko1@a...>
Date: Sat, 16 May 2009 19:46:38 +0900 (JST)
Subject: [ruby-changes:11808] Ruby:r23463 (ruby_1_8): merge r23450.

kou	2009-05-16 19:46:22 +0900 (Sat, 16 May 2009)

  New Revision: 23463

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23463

  Log:
    merge r23450.
    * lib/rss/maker.rb, lib/rss/maker/0.9.rb,
      test/test_maker_*.rb: add RSS::Maker.supported?

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/lib/rss/maker/0.9.rb
    branches/ruby_1_8/lib/rss/maker.rb
    branches/ruby_1_8/test/rss/test_maker_0.9.rb
    branches/ruby_1_8/test/rss/test_maker_1.0.rb
    branches/ruby_1_8/test/rss/test_maker_2.0.rb
    branches/ruby_1_8/test/rss/test_maker_atom_entry.rb
    branches/ruby_1_8/test/rss/test_maker_atom_feed.rb

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 23462)
+++ ruby_1_8/ChangeLog	(revision 23463)
@@ -1,3 +1,8 @@
+Sat May 16 19:46:30 2009  Kouhei Sutou  <kou@c...>
+
+	* lib/rss/maker.rb, lib/rss/maker/0.9.rb,
+	test/test_maker_*.rb: add RSS::Maker.supported?
+
 Sat May 16 19:44:09 2009  Kouhei Sutou  <kou@c...>
 
 	* lib/rss/content/*, lib/rss/dublincore/*: fix circular require.
Index: ruby_1_8/lib/rss/maker/0.9.rb
===================================================================
--- ruby_1_8/lib/rss/maker/0.9.rb	(revision 23462)
+++ ruby_1_8/lib/rss/maker/0.9.rb	(revision 23463)
@@ -501,6 +501,7 @@
     add_maker("0.9", "0.92", RSS092)
     add_maker("0.91", "0.91", RSS091)
     add_maker("0.92", "0.92", RSS092)
+    add_maker("rss0.9", "0.92", RSS092)
     add_maker("rss0.91", "0.91", RSS091)
     add_maker("rss0.92", "0.92", RSS092)
   end
Index: ruby_1_8/lib/rss/maker.rb
===================================================================
--- ruby_1_8/lib/rss/maker.rb	(revision 23462)
+++ ruby_1_8/lib/rss/maker.rb	(revision 23463)
@@ -27,6 +27,10 @@
         MAKERS.values.collect {|info| info[:maker]}.uniq
       end
 
+      def supported?(version)
+        versions.include?(version)
+      end
+
       private
       # Can I remove this method?
       def maker(version)
Index: ruby_1_8/test/rss/test_maker_2.0.rb
===================================================================
--- ruby_1_8/test/rss/test_maker_2.0.rb	(revision 23462)
+++ ruby_1_8/test/rss/test_maker_2.0.rb	(revision 23463)
@@ -4,6 +4,13 @@
 
 module RSS
   class TestMaker20 < TestCase
+    def test_supported?
+      assert(RSS::Maker.supported?("2.0"))
+      assert(RSS::Maker.supported?("rss2.0"))
+      assert(!RSS::Maker.supported?("2.2"))
+      assert(!RSS::Maker.supported?("rss2.2"))
+    end
+
     def test_find_class
       assert_equal(RSS::Maker::RSS20, RSS::Maker["2.0"])
       assert_equal(RSS::Maker::RSS20, RSS::Maker["rss2.0"])
Index: ruby_1_8/test/rss/test_maker_atom_entry.rb
===================================================================
--- ruby_1_8/test/rss/test_maker_atom_entry.rb	(revision 23462)
+++ ruby_1_8/test/rss/test_maker_atom_entry.rb	(revision 23463)
@@ -4,6 +4,12 @@
 
 module RSS
   class TestMakerAtomEntry < TestCase
+    def test_supported?
+      assert(RSS::Maker.supported?("atom:entry"))
+      assert(RSS::Maker.supported?("atom1.0:entry"))
+      assert(!RSS::Maker.supported?("atom2.0:entry"))
+    end
+
     def test_find_class
       assert_equal(RSS::Maker::Atom::Entry, RSS::Maker["atom:entry"])
       assert_equal(RSS::Maker::Atom::Entry, RSS::Maker["atom1.0:entry"])
Index: ruby_1_8/test/rss/test_maker_atom_feed.rb
===================================================================
--- ruby_1_8/test/rss/test_maker_atom_feed.rb	(revision 23462)
+++ ruby_1_8/test/rss/test_maker_atom_feed.rb	(revision 23463)
@@ -4,6 +4,15 @@
 
 module RSS
   class TestMakerAtomFeed < TestCase
+    def test_supported?
+      assert(RSS::Maker.supported?("atom"))
+      assert(RSS::Maker.supported?("atom:feed"))
+      assert(RSS::Maker.supported?("atom1.0"))
+      assert(RSS::Maker.supported?("atom1.0:feed"))
+      assert(!RSS::Maker.supported?("atom2.0"))
+      assert(!RSS::Maker.supported?("atom2.0:feed"))
+    end
+
     def test_find_class
       assert_equal(RSS::Maker::Atom::Feed, RSS::Maker["atom"])
       assert_equal(RSS::Maker::Atom::Feed, RSS::Maker["atom:feed"])
Index: ruby_1_8/test/rss/test_maker_1.0.rb
===================================================================
--- ruby_1_8/test/rss/test_maker_1.0.rb	(revision 23462)
+++ ruby_1_8/test/rss/test_maker_1.0.rb	(revision 23463)
@@ -4,6 +4,13 @@
 
 module RSS
   class TestMaker10 < TestCase
+    def test_supported?
+      assert(RSS::Maker.supported?("1.0"))
+      assert(RSS::Maker.supported?("rss1.0"))
+      assert(!RSS::Maker.supported?("1.1"))
+      assert(!RSS::Maker.supported?("rss1.1"))
+    end
+
     def test_find_class
       assert_equal(RSS::Maker::RSS10, RSS::Maker["1.0"])
       assert_equal(RSS::Maker::RSS10, RSS::Maker["rss1.0"])
Index: ruby_1_8/test/rss/test_maker_0.9.rb
===================================================================
--- ruby_1_8/test/rss/test_maker_0.9.rb	(revision 23462)
+++ ruby_1_8/test/rss/test_maker_0.9.rb	(revision 23463)
@@ -4,6 +4,17 @@
 
 module RSS
   class TestMaker09 < TestCase
+    def test_supported?
+      assert(RSS::Maker.supported?("0.9"))
+      assert(RSS::Maker.supported?("rss0.9"))
+      assert(RSS::Maker.supported?("0.91"))
+      assert(RSS::Maker.supported?("rss0.91"))
+      assert(RSS::Maker.supported?("0.92"))
+      assert(RSS::Maker.supported?("rss0.92"))
+      assert(!RSS::Maker.supported?("0.93"))
+      assert(!RSS::Maker.supported?("rss0.93"))
+    end
+
     def test_find_class
       assert_equal(RSS::Maker::RSS091, RSS::Maker["0.91"])
       assert_equal(RSS::Maker::RSS091, RSS::Maker["rss0.91"])

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]