Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Keep all methods in object/deep_dup

  • Loading branch information...
commit 98553a5574a37f96b90acb8dcfa64b4c15a93de4 1 parent 0403928
@drogus drogus authored
View
1  activesupport/lib/active_support/core_ext/array.rb
@@ -1,7 +1,6 @@
require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/array/access'
require 'active_support/core_ext/array/uniq_by'
-require 'active_support/core_ext/array/deep_dup'
require 'active_support/core_ext/array/conversions'
require 'active_support/core_ext/array/extract_options'
require 'active_support/core_ext/array/grouping'
View
6 activesupport/lib/active_support/core_ext/array/deep_dup.rb
@@ -1,6 +0,0 @@
-class Array
- # Returns a deep copy of array.
- def deep_dup
- map { |it| it.deep_dup }
- end
-end
View
1  activesupport/lib/active_support/core_ext/hash.rb
@@ -1,6 +1,5 @@
require 'active_support/core_ext/hash/conversions'
require 'active_support/core_ext/hash/deep_merge'
-require 'active_support/core_ext/hash/deep_dup'
require 'active_support/core_ext/hash/diff'
require 'active_support/core_ext/hash/except'
require 'active_support/core_ext/hash/indifferent_access'
View
8 activesupport/lib/active_support/core_ext/hash/deep_dup.rb
@@ -1,8 +0,0 @@
-class Hash
- # Returns a deep copy of hash.
- def deep_dup
- each_with_object(dup) do |(key, value), hash|
- hash[key.deep_dup] = value.deep_dup
- end
- end
-end
View
16 activesupport/lib/active_support/core_ext/object/deep_dup.rb
@@ -4,3 +4,19 @@ def deep_dup
duplicable? ? dup : self
end
end
+
+class Array
+ # Returns a deep copy of array.
+ def deep_dup
+ map { |it| it.deep_dup }
+ end
+end
+
+class Hash
+ # Returns a deep copy of hash.
+ def deep_dup
+ each_with_object(dup) do |(key, value), hash|
+ hash[key.deep_dup] = value.deep_dup
+ end
+ end
+end
View
3  activesupport/test/core_ext/deep_dup_test.rb
@@ -1,6 +1,5 @@
+require 'abstract_unit'
require 'active_support/core_ext/object'
-require 'active_support/core_ext/array'
-require 'active_support/core_ext/hash'
class DeepDupTest < ActiveSupport::TestCase
Please sign in to comment.
Something went wrong with that request. Please try again.