diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-16 10:09:42 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-11-16 10:09:42 -0800 |
commit | 254b0a4bbb5e21fe3c48ac826caec025fcaeffb5 (patch) | |
tree | 794a14c6cb87d51d8b1b985f34106b362a323547 /activesupport/lib/active_support | |
parent | 437ceab139c9aace851b41ce6103d29302750e0c (diff) | |
download | rails-254b0a4bbb5e21fe3c48ac826caec025fcaeffb5.tar.gz rails-254b0a4bbb5e21fe3c48ac826caec025fcaeffb5.tar.bz2 rails-254b0a4bbb5e21fe3c48ac826caec025fcaeffb5.zip |
using a merge with a Hash[] rather than a loop to add SAX parsed attributes
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/xml_mini/nokogirisax.rb | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/xml_mini/nokogirisax.rb b/activesupport/lib/active_support/xml_mini/nokogirisax.rb index 38c8685390..25afbfcd1c 100644 --- a/activesupport/lib/active_support/xml_mini/nokogirisax.rb +++ b/activesupport/lib/active_support/xml_mini/nokogirisax.rb @@ -38,8 +38,7 @@ module ActiveSupport end def start_element(name, attrs = []) - new_hash = { CONTENT_KEY => '' } - new_hash[attrs.shift] = attrs.shift while attrs.length > 0 + new_hash = { CONTENT_KEY => '' }.merge(Hash[attrs]) new_hash[HASH_SIZE_KEY] = new_hash.size + 1 case current_hash[name] |