diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-20 11:50:52 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-06-20 11:50:52 +0000 |
commit | 028e6396c043119448afce67ebf8f3aafc96e27e (patch) | |
tree | f7becf9f31f4b06efa89c290ca14bbde1e82a864 /lib/rss/1.0.rb | |
parent | 75823801a26e35d215fbfd243bd9bd6619a84eca (diff) |
* lib/rss/rss.rb: hide RSS::Element.install_model.
(RSS::Element.install_have_child_element,
RSS::Element.install_have_children_element,
RSS::Element.install_text_element,
RSS::Element.install_date_element): call
RSS::Element.install_model internally.
* lib/rss/0.9.rb: followed new API.
* lib/rss/1.0.rb: ditto.
* lib/rss/2.0.rb: ditto.
* lib/rss/content.rb: ditto.
* lib/rss/dublincore.rb: ditto.
* lib/rss/image.rb: ditto.
* lib/rss/syndication.rb: ditto.
* lib/rss/taxonomy.rb: ditto.
* lib/rss/trackback.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rss/1.0.rb')
-rw-r--r-- | lib/rss/1.0.rb | 76 |
1 files changed, 20 insertions, 56 deletions
diff --git a/lib/rss/1.0.rb b/lib/rss/1.0.rb index bd673661e5..ff21a3430d 100644 --- a/lib/rss/1.0.rb +++ b/lib/rss/1.0.rb @@ -38,15 +38,11 @@ module RSS [ ["channel", nil], ["image", "?"], - ["item", "+"], + ["item", "+", :children], ["textinput", "?"], - ].each do |tag, occurs| - install_model(tag, ::RSS::URI, occurs) - if occurs == "+" - install_have_children_element(tag) - else - install_have_child_element(tag) - end + ].each do |tag, occurs, type| + type ||= :child + __send__("install_have_#{type}_element", tag, ::RSS::URI, occurs) end attr_accessor :rss_version, :version, :encoding, :standalone @@ -120,8 +116,7 @@ module RSS @tag_name = 'Seq' - install_have_children_element("li") - install_model("li", URI, "*") + install_have_children_element("li", URI, "*") install_must_call_validator('rdf', ::RSS::RDF::URI) def initialize(*args) @@ -171,9 +166,8 @@ module RSS @tag_name = 'Bag' - install_have_children_element("li") - install_model("li", URI, "*") - install_must_call_validator('rdf', ::RSS::RDF::URI) + install_have_children_element("li", URI, "*") + install_must_call_validator('rdf', URI) def initialize(*args) if Utils.element_initialize_arguments?(args) @@ -227,25 +221,17 @@ module RSS "#{PREFIX}:#{name}") end - %w(title link description).each do |name| - install_text_element(name) - end - - %w(image items textinput).each do |name| - install_have_child_element(name) - end - [ - ['title', nil], - ['link', nil], - ['description', nil], - ['image', '?'], - ['items', nil], - ['textinput', '?'], - ].each do |tag, occurs| - install_model(tag, ::RSS::URI, occurs) + ['title', nil, :text], + ['link', nil, :text], + ['description', nil, :text], + ['image', '?', :have_child], + ['items', nil, :have_child], + ['textinput', '?', :have_child], + ].each do |tag, occurs, type| + __send__("install_#{type}_element", tag, ::RSS::URI, occurs) end - + def initialize(*args) if Utils.element_initialize_arguments?(args) super @@ -353,8 +339,7 @@ module RSS end - install_have_child_element("Seq") - install_model("Seq", URI, nil) + install_have_child_element("Seq", URI, nil) install_must_call_validator('rdf', URI) def initialize(*args) @@ -410,15 +395,7 @@ module RSS end %w(title url link).each do |name| - install_text_element(name) - end - - [ - ['title', nil], - ['url', nil], - ['link', nil], - ].each do |tag, occurs| - install_model(tag, ::RSS::URI, occurs) + install_text_element(name, ::RSS::URI, nil) end def initialize(*args) @@ -466,16 +443,12 @@ module RSS "#{PREFIX}:#{name}") end - %w(title link description).each do |name| - install_text_element(name) - end - [ ["title", nil], ["link", nil], ["description", "?"], ].each do |tag, occurs| - install_model(tag, ::RSS::URI, occurs) + install_text_element(tag, ::RSS::URI, occurs) end def initialize(*args) @@ -527,16 +500,7 @@ module RSS end %w(title description name link).each do |name| - install_text_element(name) - end - - [ - ["title", nil], - ["description", nil], - ["name", nil], - ["link", nil], - ].each do |tag, occurs| - install_model(tag, ::RSS::URI, occurs) + install_text_element(name, ::RSS::URI, nil) end def initialize(*args) |