Sha256: 6ae9955965d9b5e6882be0c2f1c11d6209070d62a62665dcf769eddf5609f4c6

Contents?: true

Size: 304 Bytes

Versions: 12

Compression:

Stored size: 304 Bytes

Contents

unless {}.respond_to?(:deep_dup)
  class Hash
    # Returns a deep copy of hash.
    def deep_dup
      duplicate = self.dup
      duplicate.each_pair do |k, v|
        tv = duplicate[k]
        duplicate[k] = tv.is_a?(Hash) && v.is_a?(Hash) ? tv.deep_dup : v
      end
      duplicate
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
riak-client-2.6.0 lib/riak/core_ext/deep_dup.rb
riak-client-2.5.0 lib/riak/core_ext/deep_dup.rb
riak-client-2.4.1 lib/riak/core_ext/deep_dup.rb
riak-client-2.4.0 lib/riak/core_ext/deep_dup.rb
riak-client-2.4.0.pre1 lib/riak/core_ext/deep_dup.rb
riak-client-2.3.2 lib/riak/core_ext/deep_dup.rb
riak-client-2.3.1 lib/riak/core_ext/deep_dup.rb
riak-client-2.3.0 lib/riak/core_ext/deep_dup.rb
riak-client-2.2.2 lib/riak/core_ext/deep_dup.rb
riak-client-2.2.1 lib/riak/core_ext/deep_dup.rb
riak-client-noenc-1.0.0 lib/riak/core_ext/deep_dup.rb
riak-client-2.2.0 lib/riak/core_ext/deep_dup.rb