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 | bcf72db844b54492aca33b068711992bd73caccf (patch) | |
tree | a54da3329420c04614c460c3b45388951a790aa2 /lib/rss/maker/1.0.rb | |
parent | 67c5b057e692b39c801aea811c6b75b40c4b8c22 (diff) | |
download | ruby-bcf72db844b54492aca33b068711992bd73caccf.tar.gz |
* lib/rss, test/rss, sample/rss: backported from CVS HEAD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rss/maker/1.0.rb')
-rw-r--r-- | lib/rss/maker/1.0.rb | 74 |
1 files changed, 46 insertions, 28 deletions
diff --git a/lib/rss/maker/1.0.rb b/lib/rss/maker/1.0.rb index 894bcc0a24..e38a2f89e0 100644 --- a/lib/rss/maker/1.0.rb +++ b/lib/rss/maker/1.0.rb @@ -11,41 +11,22 @@ module RSS super("1.0") end - def to_rss - rss = RDF.new(@version, @encoding, @standalone) - setup_xml_stylesheets(rss) + private + def make_rss + RDF.new(@version, @encoding, @standalone) + end + + def setup_elements(rss) setup_channel(rss) setup_image(rss) setup_items(rss) setup_textinput(rss) - setup_other_elements(rss) - if rss.channel - rss - else - nil - end - end - - private - def setup_channel(rss) - @channel.to_rss(rss) - end - - def setup_image(rss) - @image.to_rss(rss) - end - - def setup_items(rss) - @items.to_rss(rss) - end - - def setup_textinput(rss) - @textinput.to_rss(rss) end class Channel < ChannelBase def to_rss(rss) + set = false if @about channel = RDF::Channel.new(@about) set = setup_values(channel) @@ -57,12 +38,16 @@ module RSS setup_other_elements(rss) end end + + if (!@about or !set) and variable_is_set? + raise NotSetError.new("maker.channel", not_set_required_variables) + end end def have_required_values? @about and @title and @link and @description end - + private def setup_items(rss) items = RDF::Channel::Items.new @@ -86,7 +71,37 @@ module RSS end end + def required_variable_names + %w(about title link description) + end + + class SkipDays < SkipDaysBase + def to_rss(*args) + end + + class Day < DayBase + end + end + + class SkipHours < SkipHoursBase + def to_rss(*args) + end + + class Hour < HourBase + end + end + class Cloud < CloudBase + def to_rss(*args) + end + end + + class Categories < CategoriesBase + def to_rss(*args) + end + + class Category < CategoryBase + end end end @@ -153,9 +168,12 @@ module RSS end end - class Category < CategoryBase + class Categories < CategoriesBase def to_rss(*args) end + + class Category < CategoryBase + end end end end |