Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudspin/stack/instance_configuration.rb

Overview

Instance Method Summary collapse

Instance Method Details

#deep_merge(second) ⇒ Object



108
109
110
111
# File 'lib/cloudspin/stack/instance_configuration.rb', line 108

def deep_merge(second)
  merger = proc { |key, v1, v2| Hash === v1 && Hash === v2 ? v1.merge(v2, &merger) : Array === v1 && Array === v2 ? v1 | v2 : [:undefined, nil, :nil].include?(v2) ? v1 : v2 }
  self.merge(second.to_h, &merger)
end