lib/apricoteatsgorilla.rb in smacks-apricoteatsgorilla-0.3.2 vs lib/apricoteatsgorilla.rb in smacks-apricoteatsgorilla-0.3.3
- old
+ new
@@ -5,23 +5,23 @@
#
# It translates between SOAP response messages (XML) and Ruby Hashes and may
# be used to build a SOAP request envelope. It is based on CobraVsMongoose but
# uses Hpricot instead of REXML and doesn't follow the BadgerFish convention.
#
-# == Translating an XML String into a Ruby Hash
+# === Translating an XML String into a Ruby Hash
#
# xml = "<apricot><eats>Gorilla</eats></apricot>"
# ApricotEatsGorilla[xml]
# # => { :eats => "Gorilla" }
#
-# == Translating a Ruby Hash into an XML String
+# === Translating a Ruby Hash into an XML String
#
# hash = { :apricot => { :eats => "Gorilla" } }
# ApricotEatsGorilla[hash]
# # => "<apricot><eats>Gorilla</eats></apricot>"
#
-# == Creating a SOAP request envelope
+# === Creating a SOAP request envelope
#
# ApricotEatsGorilla.soap_envelope { "<authenticate>me</authenticate>" }
#
# # => '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
# # => <env:Body>
@@ -154,19 +154,18 @@
key, value = child.name, booleanize(child.children.first.to_html)
else
key, value = child.name, xml_node_to_hash(child)
end
- key = remove_namespace(key)
- key = to_snake_case(key).intern
+ key = to_snake_case(remove_namespace(key)).intern
current = this_node[key]
case current
when Array
this_node[key] << value
when nil
this_node[key] = value
else
- this_node[key] = [current.dup, value]
+ this_node[key] = [current, value]
end
end
this_node
end
\ No newline at end of file