/usr/lib/ruby/vendor_ruby/active_support/core_ext/hash/deep_dup.rb is in ruby-activesupport-3.2 3.2.16-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | class Hash
# Returns a deep copy of hash.
#
# hash = { :a => { :b => 'b' } }
# dup = hash.deep_dup
# dup[:a][:c] = 'c'
#
# hash[:a][:c] #=> nil
# dup[:a][:c] #=> "c"
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
|