diff options
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | lib/rss/maker/base.rb | 36 | ||||
-rw-r--r-- | lib/rss/maker/dublincore.rb | 6 | ||||
-rw-r--r-- | lib/rss/maker/taxonomy.rb | 6 | ||||
-rw-r--r-- | lib/rss/maker/trackback.rb | 8 | ||||
-rw-r--r-- | lib/rss/parser.rb | 8 | ||||
-rw-r--r-- | lib/rss/rss.rb | 8 | ||||
-rw-r--r-- | test/rss/test_maker_0.9.rb | 37 | ||||
-rw-r--r-- | test/rss/test_maker_1.0.rb | 68 | ||||
-rw-r--r-- | test/rss/test_maker_2.0.rb | 57 | ||||
-rw-r--r-- | test/rss/test_maker_dc.rb | 20 | ||||
-rw-r--r-- | test/rss/test_maker_taxo.rb | 10 | ||||
-rw-r--r-- | test/rss/test_maker_trackback.rb | 5 | ||||
-rw-r--r-- | test/rss/test_maker_xml-stylesheet.rb | 42 | ||||
-rw-r--r-- | test/rss/test_setup_maker_0.9.rb | 36 | ||||
-rw-r--r-- | test/rss/test_setup_maker_1.0.rb | 106 | ||||
-rw-r--r-- | test/rss/test_setup_maker_2.0.rb | 75 |
17 files changed, 316 insertions, 233 deletions
@@ -1,3 +1,24 @@ +Sat Jun 17 10:23:22 2006 Kouhei Sutou <kou@cozmixng.org> + + * lib/rss/rss.rb (Kernel#funcall): removed. + * lib/rss/parser.rb (Kernel.URI): removed. + + * lib/rss/maker/: supported + xxx.new_yyy do |yyy| + yyy.zzz = zzz + ... + end + style and this style became the style of the recommendation. + + Old style + yyy = xxx.new_yyy + yyy.zzz = zzz + ... + is supported too but this style isn't recommended. + [ruby-talk:197284] + + * test/rss/test_*maker*.rb: used new recommended style. + Sat Jun 17 09:03:47 2006 Kouhei Sutou <kou@cozmixng.org> * lib/rss, test/rss: backported from trunk. (2005-11-16 - now) diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb index 6d7dd557bf..2327dd98e4 100644 --- a/lib/rss/maker/base.rb +++ b/lib/rss/maker/base.rb @@ -207,7 +207,11 @@ EOC def new_xml_stylesheet xss = XMLStyleSheet.new(@maker) @xml_stylesheets << xss - xss + if block_given? + yield xss + else + xss + end end class XMLStyleSheet @@ -281,8 +285,12 @@ EOC def new_day day = self.class::Day.new(@maker) - @days << day - day + @days << day + if block_given? + yield day + else + day + end end def current_element(rss) @@ -311,8 +319,12 @@ EOC def new_hour hour = self.class::Hour.new(@maker) - @hours << hour - hour + @hours << hour + if block_given? + yield hour + else + hour + end end def current_element(rss) @@ -356,7 +368,11 @@ EOC def new_category category = self.class::Category.new(@maker) @categories << category - category + if block_given? + yield category + else + category + end end class CategoryBase @@ -414,8 +430,12 @@ EOC def new_item item = self.class::Item.new(@maker) - @items << item - item + @items << item + if block_given? + yield item + else + item + end end private diff --git a/lib/rss/maker/dublincore.rb b/lib/rss/maker/dublincore.rb index e038378329..0cf1255e82 100644 --- a/lib/rss/maker/dublincore.rb +++ b/lib/rss/maker/dublincore.rb @@ -53,7 +53,11 @@ EOC def new_#{name} #{name} = self.class::#{klass_name}.new(self) @#{plural_name} << #{name} - #{name} + if block_given? + yield #{name} + else + #{name} + end end def to_rss(rss, current) diff --git a/lib/rss/maker/taxonomy.rb b/lib/rss/maker/taxonomy.rb index 2e54ea66eb..f272996581 100644 --- a/lib/rss/maker/taxonomy.rb +++ b/lib/rss/maker/taxonomy.rb @@ -107,7 +107,11 @@ EOC def new_taxo_topic taxo_topic = self.class::TaxonomyTopic.new(self) @taxo_topics << taxo_topic - taxo_topic + if block_given? + yield taxo_topic + else + taxo_topic + end end def to_rss(rss, current) diff --git a/lib/rss/maker/trackback.rb b/lib/rss/maker/trackback.rb index 32254a040c..4ae6164f68 100644 --- a/lib/rss/maker/trackback.rb +++ b/lib/rss/maker/trackback.rb @@ -42,8 +42,12 @@ module RSS def new_about about = self.class::TrackBackAbout.new(@maker) - @abouts << about - about + @abouts << about + if block_given? + yield about + else + about + end end def to_rss(rss, current) diff --git a/lib/rss/parser.rb b/lib/rss/parser.rb index ace3d262f8..10c6be8534 100644 --- a/lib/rss/parser.rb +++ b/lib/rss/parser.rb @@ -4,14 +4,6 @@ begin rescue LoadError require "uri" end -unless Kernel.methods.include?("URI") - module Kernel - def URI(uri_str) # :doc: - URI.parse(uri_str) - end - module_function :URI - end -end require "rss/rss" diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb index f424f16171..589478665c 100644 --- a/lib/rss/rss.rb +++ b/lib/rss/rss.rb @@ -52,14 +52,6 @@ class Hash end end -module Kernel - unless methods.include?("funcall") - def funcall(*args, &block) - __send__(*args, &block) - end - end -end - require "English" require "rss/utils" require "rss/converter" diff --git a/test/rss/test_maker_0.9.rb b/test/rss/test_maker_0.9.rb index d8556887e1..820d567289 100644 --- a/test/rss/test_maker_0.9.rb +++ b/test/rss/test_maker_0.9.rb @@ -82,12 +82,14 @@ module RSS maker.channel.lastBuildDate = lastBuildDate skipDays.each do |day| - new_day = maker.channel.skipDays.new_day - new_day.content = day + maker.channel.skipDays.new_day do |new_day| + new_day.content = day + end end skipHours.each do |hour| - new_hour = maker.channel.skipHours.new_hour - new_hour.content = hour + maker.channel.skipHours.new_hour do |new_hour| + new_hour.content = hour + end end end channel = rss.channel @@ -261,10 +263,11 @@ module RSS rss = RSS::Maker.make("0.91") do |maker| setup_dummy_channel(maker) - item = maker.items.new_item - item.title = title - item.link = link - # item.description = description + maker.items.new_item do |item| + item.title = title + item.link = link + # item.description = description + end end assert_equal(1, rss.channel.items.size) item = rss.channel.items.first @@ -278,10 +281,11 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + end end maker.items.do_sort = true end @@ -296,10 +300,11 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + end end maker.items.do_sort = Proc.new do |x, y| y.title[-1] <=> x.title[-1] diff --git a/test/rss/test_maker_1.0.rb b/test/rss/test_maker_1.0.rb index 9d90f3bedd..e15432146d 100644 --- a/test/rss/test_maker_1.0.rb +++ b/test/rss/test_maker_1.0.rb @@ -203,10 +203,11 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - item = maker.items.new_item - item.title = title - item.link = link - # item.description = description + maker.items.new_item do |item| + item.title = title + item.link = link + # item.description = description + end end assert_equal(1, rss.items.size) item = rss.items.first @@ -221,10 +222,11 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + end end maker.items.do_sort = true end @@ -240,10 +242,11 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + end end maker.items.do_sort = Proc.new do |x, y| y.title[-1] <=> x.title[-1] @@ -262,10 +265,11 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + end end maker.items.max_size = max_size end @@ -282,10 +286,11 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + end end maker.items.max_size = max_size end @@ -296,10 +301,11 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + end end maker.items.max_size = max_size end @@ -319,18 +325,20 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - item = maker.items.new_item - # item.title = title - item.link = link + maker.items.new_item do |item| + # item.title = title + item.link = link + end end assert(rss.items.empty?) rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) - item = maker.items.new_item - item.title = title - # item.link = link + maker.items.new_item do |item| + item.title = title + # item.link = link + end end assert(rss.items.empty?) end diff --git a/test/rss/test_maker_2.0.rb b/test/rss/test_maker_2.0.rb index 2c581f75ea..ec5f3abb8e 100644 --- a/test/rss/test_maker_2.0.rb +++ b/test/rss/test_maker_2.0.rb @@ -82,17 +82,20 @@ module RSS maker.channel.lastBuildDate = lastBuildDate skipDays.each do |day| - new_day = maker.channel.skipDays.new_day - new_day.content = day + maker.channel.skipDays.new_day do |new_day| + new_day.content = day + end end skipHours.each do |hour| - new_hour = maker.channel.skipHours.new_hour - new_hour.content = hour + maker.channel.skipHours.new_hour do |new_hour| + new_hour.content = hour + end end categories.each do |category| - new_category = maker.channel.categories.new_category - new_category.content = category + maker.channel.categories.new_category do |new_category| + new_category.content = category + end end maker.channel.generator = generator @@ -368,13 +371,14 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" - item.author = "#{author}#{i}" - item.comments = "#{comments}#{i}" - item.date = pubDate + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + item.author = "#{author}#{i}" + item.comments = "#{comments}#{i}" + item.date = pubDate + end end maker.items.do_sort = true end @@ -393,13 +397,14 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" - item.author = "#{author}#{i}" - item.comments = "#{comments}#{i}" - item.date = pubDate + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + item.author = "#{author}#{i}" + item.comments = "#{comments}#{i}" + item.date = pubDate + end end maker.items.do_sort = Proc.new do |x, y| y.title[-1] <=> x.title[-1] @@ -557,9 +562,10 @@ module RSS setup_dummy_channel(maker) setup_dummy_item(maker) - category = maker.items.last.categories.new_category - category.domain = domain - category.content = content + maker.items.last.categories.new_category do |category| + category.domain = domain + category.content = content + end end category = rss.channel.items.last.categories.last assert_equal(domain, category.domain) @@ -573,8 +579,9 @@ module RSS setup_dummy_channel(maker) setup_dummy_item(maker) - category = maker.items.last.categories.new_category - # category.content = content + maker.items.last.categories.new_category do |category| + # category.content = content + end end assert(rss.channel.items.last.categories.empty?) end diff --git a/test/rss/test_maker_dc.rb b/test/rss/test_maker_dc.rb index 9f568ed441..6266e953aa 100644 --- a/test/rss/test_maker_dc.rb +++ b/test/rss/test_maker_dc.rb @@ -81,8 +81,9 @@ module RSS elems.each do |name, values, plural| dc_elems = item.__send__("dc_#{plural}") values.each do |value| - elem = dc_elems.__send__("new_#{name}") - elem.value = value + dc_elems.__send__("new_#{name}") do |elem| + elem.value = value + end end end @@ -102,14 +103,16 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.channel.date = t1 - date = maker.channel.dc_dates.new_date - date.value = t2 + maker.channel.dc_dates.new_date do |date| + date.value = t2 + end setup_dummy_item(maker) item = maker.items.last item.date = t2 - date = item.dc_dates.new_date - date.value = t1 + item.dc_dates.new_date do |date| + date.value = t1 + end end assert_equal([t1, t2], rss.channel.dc_dates.collect{|x| x.value}) assert_equal([t2, t1], rss.items.last.dc_dates.collect{|x| x.value}) @@ -131,8 +134,9 @@ module RSS plural ||= "#{name}s" dc_elems = target.__send__("dc_#{plural}") values.each do |value| - new_dc_elem = dc_elems.__send__("new_#{name}") - new_dc_elem.value = value + dc_elems.__send__("new_#{name}") do |new_dc_elem| + new_dc_elem.value = value + end end end end diff --git a/test/rss/test_maker_taxo.rb b/test/rss/test_maker_taxo.rb index 1c7d2844ce..8feb4e1d33 100644 --- a/test/rss/test_maker_taxo.rb +++ b/test/rss/test_maker_taxo.rb @@ -56,14 +56,16 @@ module RSS rss = RSS::Maker.make("1.0") do |maker| setup_dummy_channel(maker) maker.channel.date = t1 - date = maker.channel.dc_dates.new_date - date.value = t2 + maker.channel.dc_dates.new_date do |date| + date.value = t2 + end setup_dummy_item(maker) item = maker.items.last item.date = t2 - date = item.dc_dates.new_date - date.value = t1 + item.dc_dates.new_date do |date| + date.value = t1 + end end assert_equal([t1, t2], rss.channel.dc_dates.collect{|x| x.value}) assert_equal([t2, t1], rss.items.last.dc_dates.collect{|x| x.value}) diff --git a/test/rss/test_maker_trackback.rb b/test/rss/test_maker_trackback.rb index e90bb600a3..58705c6f80 100644 --- a/test/rss/test_maker_trackback.rb +++ b/test/rss/test_maker_trackback.rb @@ -25,8 +25,9 @@ module RSS item = maker.items.last item.trackback_ping = @elements[:ping] @elements[:abouts].each do |about| - new_about = item.trackback_abouts.new_about - new_about.value = about + item.trackback_abouts.new_about do |new_about| + new_about.value = about + end end end assert_trackback(@elements, rss.items.last) diff --git a/test/rss/test_maker_xml-stylesheet.rb b/test/rss/test_maker_xml-stylesheet.rb index bbdfdc682b..c380f21dc3 100644 --- a/test/rss/test_maker_xml-stylesheet.rb +++ b/test/rss/test_maker_xml-stylesheet.rb @@ -14,14 +14,15 @@ module RSS alternate = 'yes' rss = RSS::Maker.make("1.0") do |maker| - xss = maker.xml_stylesheets.new_xml_stylesheet - xss.href = href - xss.type = type - xss.title = title - xss.media = media - xss.charset = charset - xss.alternate = alternate - + maker.xml_stylesheets.new_xml_stylesheet do |xss| + xss.href = href + xss.type = type + xss.title = title + xss.media = media + xss.charset = charset + xss.alternate = alternate + end + setup_dummy_channel(maker) end @@ -37,9 +38,10 @@ module RSS href = 'http://example.com/index.xsl' type = 'text/xsl' rss = RSS::Maker.make("1.0") do |maker| - xss = maker.xml_stylesheets.new_xml_stylesheet - xss.href = href - + maker.xml_stylesheets.new_xml_stylesheet do |xss| + xss.href = href + end + setup_dummy_channel(maker) end @@ -53,19 +55,21 @@ module RSS type = "text/xsl" rss = RSS::Maker.make("1.0") do |maker| - xss = maker.xml_stylesheets.new_xml_stylesheet - # xss.href = href - xss.type = type - + maker.xml_stylesheets.new_xml_stylesheet do |xss| + # xss.href = href + xss.type = type + end + setup_dummy_channel(maker) end assert(rss.xml_stylesheets.empty?) rss = RSS::Maker.make("1.0") do |maker| - xss = maker.xml_stylesheets.new_xml_stylesheet - xss.href = href - # xss.type = type - + maker.xml_stylesheets.new_xml_stylesheet do |xss| + xss.href = href + # xss.type = type + end + setup_dummy_channel(maker) end assert(rss.xml_stylesheets.empty?) diff --git a/test/rss/test_setup_maker_0.9.rb b/test/rss/test_setup_maker_0.9.rb index 086065c2bc..9408728371 100644 --- a/test/rss/test_setup_maker_0.9.rb +++ b/test/rss/test_setup_maker_0.9.rb @@ -40,12 +40,14 @@ module RSS maker.channel.lastBuildDate = lastBuildDate skipDays.each do |day| - new_day = maker.channel.skipDays.new_day - new_day.content = day + maker.channel.skipDays.new_day do |new_day| + new_day.content = day + end end skipHours.each do |hour| - new_hour = maker.channel.skipHours.new_hour - new_hour.content = hour + maker.channel.skipHours.new_hour do |new_hour| + new_hour.content = hour + end end end @@ -149,10 +151,11 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + end end end @@ -196,14 +199,15 @@ module RSS maker.encoding = encoding maker.standalone = standalone - xss = maker.xml_stylesheets.new_xml_stylesheet - xss.href = href - xss.type = type - xss.title = title - xss.media = media - xss.charset = charset - xss.alternate = alternate - + maker.xml_stylesheets.new_xml_stylesheet do |xss| + xss.href = href + xss.type = type + xss.title = title + xss.media = media + xss.charset = charset + xss.alternate = alternate + end + setup_dummy_channel(maker) end diff --git a/test/rss/test_setup_maker_1.0.rb b/test/rss/test_setup_maker_1.0.rb index 95d8b310ba..51a4d146c7 100644 --- a/test/rss/test_setup_maker_1.0.rb +++ b/test/rss/test_setup_maker_1.0.rb @@ -195,23 +195,25 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" - - @dc_elems.each do |var, value| - item.__send__("dc_#{var}=", value) - end - - @content_elems.each do |var, value| - item.__send__("content_#{var}=", value) - end - - item.trackback_ping = @trackback_elems[:ping] - @trackback_elems[:about].each do |value| - new_about = item.trackback_abouts.new_about - new_about.value = value + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + + @dc_elems.each do |var, value| + item.__send__("dc_#{var}=", value) + end + + @content_elems.each do |var, value| + item.__send__("content_#{var}=", value) + end + + item.trackback_ping = @trackback_elems[:ping] + @trackback_elems[:about].each do |value| + item.trackback_abouts.new_about do |new_about| + new_about.value = value + end + end end end end @@ -321,14 +323,15 @@ module RSS maker.encoding = encoding maker.standalone = standalone - xss = maker.xml_stylesheets.new_xml_stylesheet - xss.href = href - xss.type = type - xss.title = title - xss.media = media - xss.charset = charset - xss.alternate = alternate - + maker.xml_stylesheets.new_xml_stylesheet do |xss| + xss.href = href + xss.type = type + xss.title = title + xss.media = media + xss.charset = charset + xss.alternate = alternate + end + setup_dummy_channel(maker) end @@ -384,14 +387,15 @@ module RSS maker.encoding = encoding maker.standalone = standalone - xss = maker.xml_stylesheets.new_xml_stylesheet - xss.href = href - xss.type = type - xss.title = title - xss.media = media - xss.charset = charset - xss.alternate = alternate - + maker.xml_stylesheets.new_xml_stylesheet do |xss| + xss.href = href + xss.type = type + xss.title = title + xss.media = media + xss.charset = charset + xss.alternate = alternate + end + maker.channel.about = channel_about maker.channel.title = channel_title maker.channel.link = channel_link @@ -418,23 +422,25 @@ module RSS end item_size.times do |i| - item = maker.items.new_item - item.title = "#{item_title}#{i}" - item.link = "#{item_link}#{i}" - item.description = "#{item_description}#{i}" - - @dc_elems.each do |var, value| - item.__send__("dc_#{var}=", value) - end - - @content_elems.each do |var, value| - item.__send__("content_#{var}=", value) - end - - item.trackback_ping = @trackback_elems[:ping] - @trackback_elems[:about].each do |value| - new_about = item.trackback_abouts.new_about - new_about.value = value + maker.items.new_item do |item| + item.title = "#{item_title}#{i}" + item.link = "#{item_link}#{i}" + item.description = "#{item_description}#{i}" + + @dc_elems.each do |var, value| + item.__send__("dc_#{var}=", value) + end + + @content_elems.each do |var, value| + item.__send__("content_#{var}=", value) + end + + item.trackback_ping = @trackback_elems[:ping] + @trackback_elems[:about].each do |value| + item.trackback_abouts.new_about do |new_about| + new_about.value = value + end + end end end diff --git a/test/rss/test_setup_maker_2.0.rb b/test/rss/test_setup_maker_2.0.rb index a35096cf16..8fb727de8d 100644 --- a/test/rss/test_setup_maker_2.0.rb +++ b/test/rss/test_setup_maker_2.0.rb @@ -46,18 +46,21 @@ module RSS maker.channel.lastBuildDate = lastBuildDate skipDays.each do |day| - new_day = maker.channel.skipDays.new_day - new_day.content = day + maker.channel.skipDays.new_day do |new_day| + new_day.content = day + end end skipHours.each do |hour| - new_hour = maker.channel.skipHours.new_hour - new_hour.content = hour + maker.channel.skipHours.new_hour do |new_hour| + new_hour.content = hour + end end categories.each do |category| - new_category = maker.channel.categories.new_category - new_category.content = category + maker.channel.categories.new_category do |new_category| + new_category.content = category + end end maker.channel.generator = generator @@ -189,27 +192,28 @@ module RSS setup_dummy_channel(maker) item_size.times do |i| - item = maker.items.new_item - item.title = "#{title}#{i}" - item.link = "#{link}#{i}" - item.description = "#{description}#{i}" - item.author = "#{author}#{i}" - item.comments = "#{comments}#{i}" - item.date = pubDate - - item.guid.isPermaLink = guid_isPermaLink - item.guid.content = guid_content - - item.enclosure.url = enclosure_url - item.enclosure.length = enclosure_length - item.enclosure.type = enclosure_type - - item.source.url = source_url - item.source.content = source_content - - category = item.categories.new_category - category.domain = category_domain - category.content = category_content + maker.items.new_item do |item| + item.title = "#{title}#{i}" + item.link = "#{link}#{i}" + item.description = "#{description}#{i}" + item.author = "#{author}#{i}" + item.comments = "#{comments}#{i}" + item.date = pubDate + + item.guid.isPermaLink = guid_isPermaLink + item.guid.content = guid_content + + item.enclosure.url = enclosure_url + item.enclosure.length = enclosure_length + item.enclosure.type = enclosure_type + + item.source.url = source_url + item.source.content = source_content + + category = item.categories.new_category + category.domain = category_domain + category.content = category_content + end end end @@ -270,14 +274,15 @@ module RSS maker.encoding = encoding maker.standalone = standalone - xss = maker.xml_stylesheets.new_xml_stylesheet - xss.href = href - xss.type = type - xss.title = title - xss.media = media - xss.charset = charset - xss.alternate = alternate - + maker.xml_stylesheets.new_xml_stylesheet do |xss| + xss.href = href + xss.type = type + xss.title = title + xss.media = media + xss.charset = charset + xss.alternate = alternate + end + setup_dummy_channel(maker) end |