aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-06-03 00:01:08 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-06-03 00:01:08 +0000
commit48052d70ec065a3a8d9e6e121cab5ae857f8da1a (patch)
treed007080f5222dbfc585f705c9046d72e3447c4d2 /activesupport/lib/active_support/core_ext/array
parent49060cda24d40d13bb428b0a1a4f3d35ef3e3c23 (diff)
downloadrails-48052d70ec065a3a8d9e6e121cab5ae857f8da1a.tar.gz
rails-48052d70ec065a3a8d9e6e121cab5ae857f8da1a.tar.bz2
rails-48052d70ec065a3a8d9e6e121cab5ae857f8da1a.zip
to_xml fixes, features, and speedup. Closes #4989.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4413 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array')
-rw-r--r--activesupport/lib/active_support/core_ext/array/conversions.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index 35d010b164..2b42a55ab1 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -52,12 +52,20 @@ module ActiveSupport #:nodoc:
options[:indent] ||= 2
options[:builder] ||= Builder::XmlMarkup.new(:indent => options[:indent])
- root = options.delete(:root)
+ root = options.delete(:root).to_s
children = options.delete(:children)
+ if !options.has_key?(:dasherize) || options[:dasherize]
+ root = root.dasherize
+ end
+
options[:builder].instruct! unless options.delete(:skip_instruct)
- options[:builder].tag!(root.to_s.dasherize) { each { |e| e.to_xml(options.merge({ :skip_instruct => true, :root => children })) } }
+
+ opts = options.merge({ :skip_instruct => true, :root => children })
+
+ options[:builder].tag!(root) { each { |e| e.to_xml(opts) } }
end
+
end
end
end