From 40c7f74543c36670db5302df6450f4e224b685ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Emin=20=C4=B0NA=C3=87?= Date: Mon, 4 May 2015 18:54:14 +0300 Subject: deep_dup method, remove old key from duplicated hash to avoid unnecessary pairs --- activesupport/lib/active_support/core_ext/object/deep_dup.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'activesupport/lib/active_support/core_ext') 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 -- cgit v1.2.3