class Hash

def deep_dup

Experimental RBS support (using type sampling data from the type_fusion project).

def deep_dup: () -> untyped

This signature was generated using 5 samples from 1 application.

dup[:a][:c] # => "c"
hash[:a][:c] # => nil

dup[:a][:c] = 'c'
dup = hash.deep_dup
hash = { a: { b: 'b' } }

Returns a deep copy of hash.
def deep_dup
  hash = dup
  each_pair do |key, value|
    if ::String === key || ::Symbol === key
      hash[key] = value.deep_dup
    else
      hash.delete(key)
      hash[key.deep_dup] = value.deep_dup
    end
  end
  hash
end