aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRobin Dupret <robin.dupret@gmail.com>2017-02-24 23:27:15 +0100
committerRobin Dupret <robin.dupret@gmail.com>2017-02-25 00:29:43 +0100
commite690a92b4498f2b65998656c625919767854623d (patch)
treec0d861773f4ba28ea0ec2c7375d47e29987baf4e /activesupport
parent87b2b6c5124732ff709b8e1900a99ba0a08f6982 (diff)
downloadrails-e690a92b4498f2b65998656c625919767854623d.tar.gz
rails-e690a92b4498f2b65998656c625919767854623d.tar.bz2
rails-e690a92b4498f2b65998656c625919767854623d.zip
Soft-deprecate the top-level HashWithIndifferentAccess class
Since using a `ActiveSupport::Deprecation::DeprecatedConstantProxy` would prevent people from inheriting this class and extending it from the `ActiveSupport::HashWithIndifferentAccess` one would break the ancestors chain, that's the best option we have here.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md6
-rw-r--r--activesupport/lib/active_support/hash_with_indifferent_access.rb2
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb4
3 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 0f43b1256f..d43927967f 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,3 +1,9 @@
+* Soft-deprecated the top-level `HashWithIndifferentAcces` constant.
+ `ActiveSupport::HashWithIndifferentAccess` should be used instead.
+
+ *Robin Dupret* (#28157)
+
+
## Rails 5.1.0.beta1 (February 23, 2017) ##
* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb
index f9b269ad69..1927cddf34 100644
--- a/activesupport/lib/active_support/hash_with_indifferent_access.rb
+++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb
@@ -316,4 +316,6 @@ module ActiveSupport
end
end
+# :stopdoc:
+
HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index a6e3e59433..efe211677e 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -8,6 +8,8 @@ require "active_support/core_ext/object/deep_dup"
require "active_support/inflections"
class HashExtTest < ActiveSupport::TestCase
+ HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess
+
class IndifferentHash < ActiveSupport::HashWithIndifferentAccess
end
@@ -1133,6 +1135,8 @@ class HashExtToParamTests < ActiveSupport::TestCase
end
class HashToXmlTest < ActiveSupport::TestCase
+ HashWithIndifferentAccess = ActiveSupport::HashWithIndifferentAccess
+
def setup
@xml_options = { root: :person, skip_instruct: true, indent: 0 }
end