diff options
| author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-08 12:58:36 +0000 |
|---|---|---|
| committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-12-08 12:58:36 +0000 |
| commit | 2fa78a09f7d3c35640f261cc427944a5011401cc (patch) | |
| tree | a54da3329420c04614c460c3b45388951a790aa2 /lib/rss/maker/2.0.rb | |
| parent | 1fc7f84ed05d1a457040d9be92e753ceb6cc66ce (diff) | |
| download | ruby-2fa78a09f7d3c35640f261cc427944a5011401cc.tar.gz ruby-2fa78a09f7d3c35640f261cc427944a5011401cc.tar.xz ruby-2fa78a09f7d3c35640f261cc427944a5011401cc.zip | |
* lib/rss, test/rss, sample/rss: backported from CVS HEAD.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rss/maker/2.0.rb')
| -rw-r--r-- | lib/rss/maker/2.0.rb | 73 |
1 files changed, 56 insertions, 17 deletions
diff --git a/lib/rss/maker/2.0.rb b/lib/rss/maker/2.0.rb index 05fc46480..a95866161 100644 --- a/lib/rss/maker/2.0.rb +++ b/lib/rss/maker/2.0.rb @@ -13,23 +13,30 @@ module RSS class Channel < RSS09::Channel - add_other_element("cloud") - def have_required_values? @title and @link and @description end - private - def setup_cloud(rss, current) - @maker.channel.cloud.to_rss(rss) + def required_variable_names + %w(title link description) end - + + class SkipDays < RSS09::Channel::SkipDays + class Day < RSS09::Channel::SkipDays::Day + end + end + + class SkipHours < RSS09::Channel::SkipHours + class Hour < RSS09::Channel::SkipHours::Hour + end + end + class Cloud < RSS09::Channel::Cloud - def to_rss(rss) + def to_rss(rss, channel) cloud = Rss::Channel::Cloud.new set = setup_values(cloud) if set - rss.channel.cloud = cloud + channel.cloud = cloud setup_other_elements(rss) end end @@ -39,6 +46,30 @@ module RSS @registerProcedure and @protocol end end + + class Categories < RSS09::Channel::Categories + def to_rss(rss, channel) + @categories.each do |category| + category.to_rss(rss, channel) + end + end + + class Category < RSS09::Channel::Categories::Category + def to_rss(rss, channel) + category = Rss::Channel::Category.new + set = setup_values(category) + if set + channel.categories << category + setup_other_elements(rss) + end + end + + def have_required_values? + @content + end + end + end + end class Image < RSS09::Image @@ -102,18 +133,26 @@ module RSS end end - class Category < RSS09::Items::Item::Category + class Categories < RSS09::Items::Item::Categories def to_rss(rss, item) - category = Rss::Channel::Item::Category.new - set = setup_values(category) - if set - item.category = category - setup_other_elements(rss) + @categories.each do |category| + category.to_rss(rss, item) end end - - def have_required_values? - @content + + class Category < RSS09::Items::Item::Categories::Category + def to_rss(rss, item) + category = Rss::Channel::Item::Category.new + set = setup_values(category) + if set + item.categories << category + setup_other_elements(rss) + end + end + + def have_required_values? + @content + end end end end |
