using a merge with a Hash[] rather than a loop to add SAX parsed attributes

This commit is contained in:
Aaron Patterson 2010-11-16 10:09:42 -08:00
parent 437ceab139
commit 254b0a4bbb
2 changed files with 2 additions and 3 deletions

View File

@ -39,7 +39,7 @@ end
platforms :ruby do
gem 'json'
gem 'yajl-ruby'
gem "nokogiri", ">= 1.4.3.1"
gem "nokogiri", ">= 1.4.4"
# AR
gem "sqlite3-ruby", "~> 1.3.1", :require => 'sqlite3'

View File

@ -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]