1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Don't really want to recursively merge arrays in the options hash.

git-svn-id: svn://hamptoncatlin.com/haml/trunk@452 7063305b-7217-0410-af8c-cdc13e5119b9
This commit is contained in:
nex3 2007-03-26 05:33:41 +00:00
parent 1f112ca018
commit 63c8cf6ba5

View file

@ -3,14 +3,12 @@
class Hash # :nodoc: class Hash # :nodoc:
# Same as Hash#merge!, # Same as Hash#merge!,
# but recursively merges sub-hashes and arrays # but recursively merges sub-hashes
def rec_merge!(other) def rec_merge!(other)
other.each do |key, value| other.each do |key, value|
myval = self[key] myval = self[key]
if value.is_a?(Hash) && myval.is_a?(Hash) if value.is_a?(Hash) && myval.is_a?(Hash)
myval.rec_merge!(value) myval.rec_merge!(value)
elsif value.is_a?(Array) && myval.is_a?(Array)
myval.concat(value)
else else
self[key] = value self[key] = value
end end