Class: Hash
Instance Method Summary collapse
Instance Method Details
#recursive_merge(other) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/bosh/director/ext.rb', line 14 def recursive_merge(other) self.merge(other) do |_, old_value, new_value| if old_value.class == Hash && new_value.class == Hash old_value.recursive_merge(new_value) else new_value end end end |
#to_openstruct ⇒ Object
24 25 26 27 28 |
# File 'lib/bosh/director/ext.rb', line 24 def to_openstruct mapped = {} each { |key, value| mapped[key] = value.to_openstruct } OpenStruct.new(mapped) end |