diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-27 08:47:28 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-11-27 08:47:28 +0000 |
commit | 2572d5e20efb42599759f97b1ec0cc66c15fb14a (patch) | |
tree | 1ce8b2aa09c9351b5e1efae7981c80d1bc916d85 /lib/rss/0.9.rb | |
parent | 0a93165e167a4d1d6b0f8a2dc0479524f49855d4 (diff) | |
download | ruby-2572d5e20efb42599759f97b1ec0cc66c15fb14a.tar.gz |
* lib/rss/{0.9,1.0,2.0,trackback,xml-stylesheet}.rb: added
#setup_maker.
* test/rss/test_setup_maker_*.rb: added tests for #setup_maker.
* lib/rss/maker/base.rb(RSS::Maker::Items#max_size=): supported
output item size limitation.
* sample/rss/blend.rb: added sample for RSS Maker.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rss/0.9.rb')
-rw-r--r-- | lib/rss/0.9.rb | 69 |
1 files changed, 67 insertions, 2 deletions
diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb index 20a229b926..b80ad193a3 100644 --- a/lib/rss/0.9.rb +++ b/lib/rss/0.9.rb @@ -203,6 +203,26 @@ module RSS rv end + def maker_target(maker) + maker.channel + end + + def setup_maker_elements(channel) + super + [ + [skipDays, "day"], + [skipHours, "hour"], + ].each do |skip, key| + if skip + skip.__send__("#{key}s").each do |val| + target_skips = channel.__send__("skip#{key.capitalize}s") + new_target = target_skips.__send__("new_#{key}") + new_target.content = val.content + end + end + end + end + class SkipDays < Element include RSS09 @@ -323,7 +343,7 @@ module RSS other_element(false, next_indent), ] end - rv = @converter.convert(rv) if convert and @converter + rv = @converter.convert(rv) if convert and @converter rv end @@ -335,6 +355,10 @@ module RSS [nil, elem] end end + + def maker_target(maker) + maker.image + end end class Cloud < Element @@ -440,6 +464,16 @@ module RSS rv end + def maker_target(maker) + maker.items.new_item + end + + def setup_maker_element(item) + super + @enclosure.setup_maker(item) if @enclosure + @source.setup_maker(item) if @source + end + class Source < Element include RSS09 @@ -469,6 +503,15 @@ module RSS ] end + + def maker_target(item) + item.source + end + + def setup_maker_attributes(source) + source.url = url + source.content = content + end end class Enclosure < Element @@ -505,6 +548,15 @@ module RSS ] end + def maker_target(item) + item.enclosure + end + + def setup_maker_attributes(enclosure) + enclosure.url = url + enclosure.length = length + enclosure.type = type + end end class Category < Element @@ -532,6 +584,15 @@ module RSS ] end + def maker_target(item) + item.new_category + end + + def setup_maker_attributes(category) + category.domain = domain + category.content = content + end + end end @@ -555,7 +616,7 @@ module RSS other_element(false, next_indent), ] end - rv = @converter.convert(rv) if convert and @converter + rv = @converter.convert(rv) if convert and @converter rv end @@ -567,6 +628,10 @@ module RSS [nil, elem] end end + + def maker_target(maker) + maker.textinput + end end end |