2007-03-25 19:07:16 +00:00
|
|
|
# This file contains various useful bits of code
|
|
|
|
# that are shared between Haml and Sass.
|
|
|
|
|
|
|
|
class Hash # :nodoc:
|
|
|
|
# Same as Hash#merge!,
|
2007-03-26 05:33:41 +00:00
|
|
|
# but recursively merges sub-hashes
|
2007-03-25 19:07:16 +00:00
|
|
|
def rec_merge!(other)
|
|
|
|
other.each do |key, value|
|
|
|
|
myval = self[key]
|
|
|
|
if value.is_a?(Hash) && myval.is_a?(Hash)
|
|
|
|
myval.rec_merge!(value)
|
|
|
|
else
|
|
|
|
self[key] = value
|
|
|
|
end
|
|
|
|
end
|
|
|
|
self
|
|
|
|
end
|
|
|
|
end
|