aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2012-05-06 11:12:54 -0700
committerPiotr Sarnacki <drogus@gmail.com>2012-05-06 11:13:15 -0700
commit98553a5574a37f96b90acb8dcfa64b4c15a93de4 (patch)
tree35376bda7598367b037df9abdece206e1bdf8d82 /activesupport
parent040392860886d9362b33c6c8ef99113a99dd18cf (diff)
downloadrails-98553a5574a37f96b90acb8dcfa64b4c15a93de4.tar.gz
rails-98553a5574a37f96b90acb8dcfa64b4c15a93de4.tar.bz2
rails-98553a5574a37f96b90acb8dcfa64b4c15a93de4.zip
Keep all methods in object/deep_dup
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/array.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/array/deep_dup.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/hash.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/hash/deep_dup.rb8
-rw-r--r--activesupport/lib/active_support/core_ext/object/deep_dup.rb16
-rw-r--r--activesupport/test/core_ext/deep_dup_test.rb3
6 files changed, 17 insertions, 18 deletions
diff --git a/activesupport/lib/active_support/core_ext/array.rb b/activesupport/lib/active_support/core_ext/array.rb
index d6e1398a27..79ba79192a 100644
--- a/activesupport/lib/active_support/core_ext/array.rb
+++ b/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'
diff --git a/activesupport/lib/active_support/core_ext/array/deep_dup.rb b/activesupport/lib/active_support/core_ext/array/deep_dup.rb
deleted file mode 100644
index 82f9805236..0000000000
--- a/activesupport/lib/active_support/core_ext/array/deep_dup.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class Array
- # Returns a deep copy of array.
- def deep_dup
- map { |it| it.deep_dup }
- end
-end
diff --git a/activesupport/lib/active_support/core_ext/hash.rb b/activesupport/lib/active_support/core_ext/hash.rb
index fd1cda991e..501483498d 100644
--- a/activesupport/lib/active_support/core_ext/hash.rb
+++ b/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'
diff --git a/activesupport/lib/active_support/core_ext/hash/deep_dup.rb b/activesupport/lib/active_support/core_ext/hash/deep_dup.rb
deleted file mode 100644
index 882f27623e..0000000000
--- a/activesupport/lib/active_support/core_ext/hash/deep_dup.rb
+++ /dev/null
@@ -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
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 daae98dde1..2c4383ac94 100644
--- a/activesupport/lib/active_support/core_ext/object/deep_dup.rb
+++ b/activesupport/lib/active_support/core_ext/object/deep_dup.rb
@@ -4,3 +4,19 @@ class Object
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
diff --git a/activesupport/test/core_ext/deep_dup_test.rb b/activesupport/test/core_ext/deep_dup_test.rb
index 2a00fc5315..91d558dbb5 100644
--- a/activesupport/test/core_ext/deep_dup_test.rb
+++ b/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