aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/xml_mini.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-08 12:25:02 +0200
committerJosé Valim <jose.valim@gmail.com>2011-05-08 12:25:02 +0200
commitad129639c7e72c3ba686db6202a4bff2cb2cfbfe (patch)
treeb07191933aef9bac3e2159fc98683f20aa3388fb /activesupport/lib/active_support/xml_mini.rb
parent67c3469e6ff1b63b091594d6dba7f871023df553 (diff)
downloadrails-ad129639c7e72c3ba686db6202a4bff2cb2cfbfe.tar.gz
rails-ad129639c7e72c3ba686db6202a4bff2cb2cfbfe.tar.bz2
rails-ad129639c7e72c3ba686db6202a4bff2cb2cfbfe.zip
Fix failing xml mini test.
Diffstat (limited to 'activesupport/lib/active_support/xml_mini.rb')
-rw-r--r--activesupport/lib/active_support/xml_mini.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/xml_mini.rb b/activesupport/lib/active_support/xml_mini.rb
index dff8a8f4c4..d8f40ab8b1 100644
--- a/activesupport/lib/active_support/xml_mini.rb
+++ b/activesupport/lib/active_support/xml_mini.rb
@@ -139,7 +139,10 @@ module ActiveSupport
protected
def _dasherize(key)
- key.gsub(/(?!^[_]*)_(?![_]*$)/, '-')
+ left = key.strip.rpartition(/^_*/)
+ right = left.pop.partition(/_*$/)
+ right.first.tr!('_ ', '--')
+ left.concat(right).join
end
# TODO: Add support for other encodings