From ad129639c7e72c3ba686db6202a4bff2cb2cfbfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 8 May 2011 12:25:02 +0200 Subject: Fix failing xml mini test. --- activesupport/lib/active_support/xml_mini.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activesupport') 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 -- cgit v1.2.3