aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-05-04 18:54:14 +0300
committerMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-05-04 18:54:14 +0300
commit40c7f74543c36670db5302df6450f4e224b685ed (patch)
treec03e3b28e99abf0c67a62d7f68834a7003b0b2c1 /activesupport/lib/active_support
parent9619331001828a9877b7a1e1a451f7ab98ca0285 (diff)
downloadrails-40c7f74543c36670db5302df6450f4e224b685ed.tar.gz
rails-40c7f74543c36670db5302df6450f4e224b685ed.tar.bz2
rails-40c7f74543c36670db5302df6450f4e224b685ed.zip
deep_dup method, remove old key from duplicated hash to avoid unnecessary pairs
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/object/deep_dup.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/object/deep_dup.rb b/activesupport/lib/active_support/core_ext/object/deep_dup.rb
index 0191d2e973..ad5b2af161 100644
--- a/activesupport/lib/active_support/core_ext/object/deep_dup.rb
+++ b/activesupport/lib/active_support/core_ext/object/deep_dup.rb
@@ -40,6 +40,7 @@ class Hash
# dup[:a][:c] # => "c"
def deep_dup
each_with_object(dup) do |(key, value), hash|
+ hash.delete(key)
hash[key.deep_dup] = value.deep_dup
end
end