summaryrefslogtreecommitdiff
path: root/lib/rss
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rss')
-rw-r--r--lib/rss/0.9.rb7
-rw-r--r--lib/rss/rss.rb35
2 files changed, 19 insertions, 23 deletions
diff --git a/lib/rss/0.9.rb b/lib/rss/0.9.rb
index f0060cbad5..cfd2596bcc 100644
--- a/lib/rss/0.9.rb
+++ b/lib/rss/0.9.rb
@@ -70,6 +70,13 @@ module RSS
rv
end
+ def setup_maker_elements(maker)
+ super
+ items.each do |item|
+ item.setup_maker(maker.items)
+ end
+ end
+
private
def children
[@channel]
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index 589478665c..c36cee050a 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -30,28 +30,6 @@ class Time
end
end
-module Enumerable
- unless instance_methods.include?("sort_by")
- def sort_by
- collect do |x|
- [yield(x), x]
- end.sort do |x, y|
- x[0] <=> y[0]
- end.collect! do |x|
- x[1]
- end
- end
- end
-end
-
-class Hash
- unless instance_methods.include?("merge")
- def merge(other)
- dup.update(other)
- end
- end
-end
-
require "English"
require "rss/utils"
require "rss/converter"
@@ -946,7 +924,18 @@ EOC
setup_maker_elements(maker)
end
-
+
+ def to_xml(version=nil, &block)
+ if version.nil? or version == @rss_version
+ to_s
+ else
+ RSS::Maker.make(version) do |maker|
+ setup_maker(maker)
+ block.call(maker) if block
+ end.to_s
+ end
+ end
+
private
def tag(indent, attrs, &block)
rv = xmldecl + xml_stylesheet_pi