Sha256: 068613b772143235d2025500b58f73c3e8e1100adf3402fbf6650ed615d1ed3c

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

module VagrantPlugins::OpsWorks
  require 'vagrant/util/hash_with_indifferent_access'
  class CustomJson < ::Vagrant::Util::HashWithIndifferentAccess

    def deep_merge(other_json, &block)
      dup.deep_merge!(other_json, &block)
    end

    def deep_merge!(other_json, &block)
      other_json.each_pair do |k,theirs|
        ours = self[k]
        if ours.is_a?(CustomJson) && theirs.is_a?(Hash)
          self[k] = ours.deep_merge!(theirs, &block)
        else
          self[k] = block && ours ? block.call(k, ours, theirs) : theirs
        end
      end
      self
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-opsworks-0.0.5 lib/vagrant-opsworks/custom_json.rb