aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2019-01-15 17:21:19 -0500
committerRafael Mendonça França <rafaelmfranca@gmail.com>2019-01-17 16:08:34 -0500
commit6eb1d56a333fd2015610d31793ed6281acd66551 (patch)
treee0be225b000d0446cd9385343ef0ff4bd8718559 /activesupport
parent0ce67d3cd6d1b7b9576b07fecae3dd5b422a5689 (diff)
downloadrails-6eb1d56a333fd2015610d31793ed6281acd66551.tar.gz
rails-6eb1d56a333fd2015610d31793ed6281acd66551.tar.bz2
rails-6eb1d56a333fd2015610d31793ed6281acd66551.zip
Remove deprecated `Module#reachable?` method
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG.md4
-rw-r--r--activesupport/lib/active_support/core_ext/module.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/module/reachable.rb7
-rw-r--r--activesupport/test/core_ext/module/reachable_test.rb51
4 files changed, 5 insertions, 58 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 7f413ccf6e..68f5e86552 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Remove deprecated `Module#reachable?` method.
+
+ *Rafael Mendonça França*
+
* Remove deprecated `#acronym_regex` method from `Inflections`.
*Rafael Mendonça França*
diff --git a/activesupport/lib/active_support/core_ext/module.rb b/activesupport/lib/active_support/core_ext/module.rb
index d91e3fba6a..542af98c04 100644
--- a/activesupport/lib/active_support/core_ext/module.rb
+++ b/activesupport/lib/active_support/core_ext/module.rb
@@ -3,7 +3,6 @@
require "active_support/core_ext/module/aliasing"
require "active_support/core_ext/module/introspection"
require "active_support/core_ext/module/anonymous"
-require "active_support/core_ext/module/reachable"
require "active_support/core_ext/module/attribute_accessors"
require "active_support/core_ext/module/attribute_accessors_per_thread"
require "active_support/core_ext/module/attr_internal"
diff --git a/activesupport/lib/active_support/core_ext/module/reachable.rb b/activesupport/lib/active_support/core_ext/module/reachable.rb
index e9cbda5245..2020f5204c 100644
--- a/activesupport/lib/active_support/core_ext/module/reachable.rb
+++ b/activesupport/lib/active_support/core_ext/module/reachable.rb
@@ -3,9 +3,4 @@
require "active_support/core_ext/module/anonymous"
require "active_support/core_ext/string/inflections"
-class Module
- def reachable? #:nodoc:
- !anonymous? && name.safe_constantize.equal?(self)
- end
- deprecate :reachable?
-end
+ActiveSupport::Deprecation.warn("reachable is deprecated and will be removed from the framework.")
diff --git a/activesupport/test/core_ext/module/reachable_test.rb b/activesupport/test/core_ext/module/reachable_test.rb
deleted file mode 100644
index f356d46957..0000000000
--- a/activesupport/test/core_ext/module/reachable_test.rb
+++ /dev/null
@@ -1,51 +0,0 @@
-# frozen_string_literal: true
-
-require "abstract_unit"
-require "active_support/core_ext/module/reachable"
-
-class AnonymousTest < ActiveSupport::TestCase
- test "an anonymous class or module is not reachable" do
- assert_deprecated do
- assert_not_predicate Module.new, :reachable?
- assert_not_predicate Class.new, :reachable?
- end
- end
-
- test "ordinary named classes or modules are reachable" do
- assert_deprecated do
- assert_predicate Kernel, :reachable?
- assert_predicate Object, :reachable?
- end
- end
-
- test "a named class or module whose constant has gone is not reachable" do
- c = eval "class C; end; C"
- m = eval "module M; end; M"
-
- self.class.send(:remove_const, :C)
- self.class.send(:remove_const, :M)
-
- assert_deprecated do
- assert_not_predicate c, :reachable?
- assert_not_predicate m, :reachable?
- end
- end
-
- test "a named class or module whose constants store different objects are not reachable" do
- c = eval "class C; end; C"
- m = eval "module M; end; M"
-
- self.class.send(:remove_const, :C)
- self.class.send(:remove_const, :M)
-
- eval "class C; end"
- eval "module M; end"
-
- assert_deprecated do
- assert_predicate C, :reachable?
- assert_predicate M, :reachable?
- assert_not_predicate c, :reachable?
- assert_not_predicate m, :reachable?
- end
- end
-end