class Hash

Public Instance Methods

deep_merge(other) click to toggle source
# File lib/cfoo/processor.rb, line 3
def deep_merge(other)
    merge(other) do |key, our_item, their_item|
        if [our_item, their_item].all? {|item| item.respond_to? :deep_merge }
            our_item.deep_merge(their_item)
        elsif [our_item, their_item].all? {|item| item.respond_to?(:+) && item.respond_to?(:uniq) }
            our_item.concat(their_item).uniq
        else
            their_item
        end
    end
end
expand_el() click to toggle source
# File lib/cfoo/parser.rb, line 52
def expand_el
    Hash[map do |key, value|
        [ key, value.expand_el ]
    end]
end