using a merge with a Hash[] rather than a loop to add SAX parsed attributes
This commit is contained in:
parent
437ceab139
commit
254b0a4bbb
2
Gemfile
2
Gemfile
@ -39,7 +39,7 @@ end
|
|||||||
platforms :ruby do
|
platforms :ruby do
|
||||||
gem 'json'
|
gem 'json'
|
||||||
gem 'yajl-ruby'
|
gem 'yajl-ruby'
|
||||||
gem "nokogiri", ">= 1.4.3.1"
|
gem "nokogiri", ">= 1.4.4"
|
||||||
|
|
||||||
# AR
|
# AR
|
||||||
gem "sqlite3-ruby", "~> 1.3.1", :require => 'sqlite3'
|
gem "sqlite3-ruby", "~> 1.3.1", :require => 'sqlite3'
|
||||||
|
@ -38,8 +38,7 @@ def error(error_message)
|
|||||||
end
|
end
|
||||||
|
|
||||||
def start_element(name, attrs = [])
|
def start_element(name, attrs = [])
|
||||||
new_hash = { CONTENT_KEY => '' }
|
new_hash = { CONTENT_KEY => '' }.merge(Hash[attrs])
|
||||||
new_hash[attrs.shift] = attrs.shift while attrs.length > 0
|
|
||||||
new_hash[HASH_SIZE_KEY] = new_hash.size + 1
|
new_hash[HASH_SIZE_KEY] = new_hash.size + 1
|
||||||
|
|
||||||
case current_hash[name]
|
case current_hash[name]
|
||||||
|
Loading…
Reference in New Issue
Block a user