Sha256: 058090af68d55bfd76d6059dcb91d85b3b204b58190f9c2e9057fd20bdf9aa76

Contents?: true

Size: 464 Bytes

Versions: 3

Compression:

Stored size: 464 Bytes

Contents

# encoding: utf-8

module PagesCore
  module Extensions
    module HashExtensions
      def deep_merge(hash)
        target = dup

        hash.keys.each do |key|
          if hash[key].is_a?(Hash) && self[key].is_a?(Hash)
            target[key] = target[key].deep_merge(hash[key])
            next
          end

          target[key] = hash[key]
        end

        target
      end
    end
  end
end
Hash.send(:include, PagesCore::Extensions::HashExtensions)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pages_core-3.4.3 lib/pages_core/extensions/hash_extensions.rb
pages_core-3.5.1 lib/pages_core/extensions/hash_extensions.rb
pages_core-3.4.2 lib/pages_core/extensions/hash_extensions.rb