Sha256: 12b1abc72c25a66867cfbbcc1f713c282e844936733f2a8b1e3edbf34ca2e97b

Contents?: true

Size: 303 Bytes

Versions: 33

Compression:

Stored size: 303 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

33 entries across 23 versions & 2 rubygems

Version Path
riak-client-2.2.0.pre1 lib/riak/core_ext/deep_dup.rb
riak-client-2.1.0 lib/riak/core_ext/deep_dup.rb
riak-client-1.4.5 lib/riak/core_ext/deep_dup.rb
riak-client-2.0.0 lib/riak/core_ext/deep_dup.rb
riak-client-2.0.0.rc2 lib/riak/core_ext/deep_dup.rb
riak-client-2.0.0.rc1 lib/riak/core_ext/deep_dup.rb
riak-client-1.4.4.1 lib/riak/core_ext/deep_dup.rb
riak-client-1.4.4 lib/riak/core_ext/deep_dup.rb
riak-client-1.4.3 lib/riak/core_ext/deep_dup.rb
riak-client-1.4.2 lib/riak/core_ext/deep_dup.rb
riak-client-1.4.1 lib/riak/core_ext/deep_dup.rb
riak-client-1.4.0 lib/riak/core_ext/deep_dup.rb
riak-client-1.2.0 lib/riak/core_ext/deep_dup.rb
riak-client-1.1.1 lib/riak/core_ext/deep_dup.rb
riak-client-1.1.0 lib/riak/core_ext/deep_dup.rb
better-riak-client-1.0.7 lib/riak/core_ext/deep_dup.rb
better-riak-client-1.0.6 lib/riak/core_ext/deep_dup.rb
riak-client-1.0.5 lib/riak/core_ext/deep_dup.rb
better-riak-client-1.0.5 lib/riak/core_ext/deep_dup.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.0/lib/riak/core_ext/deep_dup.rb