aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/hash/diff.rb
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2012-11-09 15:24:05 +0100
committerSteve Klabnik <steve@steveklabnik.com>2012-11-09 15:57:18 +0100
commit88d59de12d9951c0ac18a1e53e52f92c00c15849 (patch)
tree071cb9c1beffdd548fb094188c1e128a35022041 /activesupport/lib/active_support/core_ext/hash/diff.rb
parent6710f057f9033aec2ef62b961b9a2000a2d499e5 (diff)
downloadrails-88d59de12d9951c0ac18a1e53e52f92c00c15849.tar.gz
rails-88d59de12d9951c0ac18a1e53e52f92c00c15849.tar.bz2
rails-88d59de12d9951c0ac18a1e53e52f92c00c15849.zip
Deprecate Hash#diff.
It's no longer used in Rails any more. See https://github.com/rails/rails/pull/8142\#issuecomment-10227297 for more
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash/diff.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/diff.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/diff.rb b/activesupport/lib/active_support/core_ext/hash/diff.rb
index 831dee8ecb..a27c55479a 100644
--- a/activesupport/lib/active_support/core_ext/hash/diff.rb
+++ b/activesupport/lib/active_support/core_ext/hash/diff.rb
@@ -6,6 +6,7 @@ class Hash
# {}.diff(1 => 2) # => {1 => 2}
# {1 => 2, 3 => 4}.diff(1 => 2) # => {3 => 4}
def diff(other)
+ ActiveSupport::Deprecation.warn "Hash#diff is no longer used inside of Rails, and is being deprecated with no replacement. If you're using it to compare hashes for the purpose of testing, please use MiniTest's diff instead."
dup.
delete_if { |k, v| other[k] == v }.
merge!(other.dup.delete_if { |k, v| has_key?(k) })