Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/reposh.rb

Instance Method Summary collapse

Instance Method Details

#recursive_merge(other) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/reposh.rb', line 7

def recursive_merge(other)
  self.merge(other) do |key, my_val, other_val|
    # for values of a same key
    if my_val.is_a? Hash and other_val.is_a? Hash
      my_val.recursive_merge(other_val) # XXX: hang-ups for cyclic hash?
    else
      other_val
    end
  end
end