Class: Hash

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

Overview

From: www.ruby-forum.com/topic/142809 Author: Stefan Rusterholz

Instance Method Summary collapse

Instance Method Details

#deep_merge(second) ⇒ Object



4
5
6
7
# File 'lib/hash.rb', line 4

def deep_merge(second)
   merger = proc { |key,v1,v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : v2 }
   self.merge(second, &merger)
end