vendor/rails/activesupport/lib/active_support/xml_mini/rexml.rb
# Adds a new key/value pair to an existing Hash. If the key to be added
# already exists and the existing value associated with key is not
# an Array, it will be wrapped in an Array. Then the new value is
# appended to that Array.
#
# hash::
#   Hash to add key/value pair to.
# key::
#   Key to be added.
# value::
#   Value to be associated with key.
Adds a new key/value pair to an existing Hash. If the key to be added
already exists and the existing value associated with key is not
an Array, it will be wrapped in an Array. Then the new value is
appended to that Array.

:
Hash to add key/value pair to.
key::
Key to be added.
value::
Value to be associated with key.
Adds a new key / value pair to an existing Hash . If the key to be added already exists and the existing value associated with key is not an Array it will be wrapped in an Array . Then the new value is appended to that Array . : Hash to add key / value pair to . key :: Key to be added . value :: Value to be associated with key .
def merge!(hash, key, value)
        if hash.has_key?(key)
          if hash[key].instance_of?(Array)
            hash[key] << value
          else
            hash[key] = [hash[key], value]
          end
        elsif value.instance_of?(Array)
          hash[key] = [value]
        else
          hash[key] = value
        end
        hash
      end
def merge! ( hash , key , value ) if hash . has_key? ( key ) if hash [ key ] . instance_of? ( Array ) hash [ key ] << value else hash [ key ] = [ hash [ key ] , value ] end elsif value . instance_of? ( Array ) hash [ key ] = [ value ] else hash [ key ] = value end hash end
Adds a new key/value pair to an existing Hash.
Adds a new key / value pair to an existing Hash .
hash
<not_specific>
key
<not_specific>
value
<not_specific>