Sha256: bbb719eac8572d3a5686d77217147b9d0d83c6e47801ceaf5035675d7c993fa9

Contents?: true

Size: 427 Bytes

Versions: 25

Compression:

Stored size: 427 Bytes

Contents

# frozen_string_literal: true

module Anyway
  using Anyway::Ext::DeepDup

  module Utils
    def self.deep_merge!(source, other)
      other.each do |key, other_value|
        this_value = source[key]

        if this_value.is_a?(::Hash) && other_value.is_a?(::Hash)
          deep_merge!(this_value, other_value)
        else
          source[key] = other_value.deep_dup
        end
      end

      source
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
anyway_config-2.2.3 lib/anyway/utils/deep_merge.rb
anyway_config-2.2.2 lib/anyway/utils/deep_merge.rb
anyway_config-2.2.1 lib/anyway/utils/deep_merge.rb
anyway_config-2.2.0 lib/anyway/utils/deep_merge.rb
anyway_config-2.1.0 lib/anyway/utils/deep_merge.rb