diff options
author | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-09-17 02:32:32 +0300 |
---|---|---|
committer | bogdanvlviv <bogdanvlviv@gmail.com> | 2017-09-17 02:32:32 +0300 |
commit | 275065355c833b769daf898bf7940c0ff98b6a7c (patch) | |
tree | f1dac130dee3a7c73889e7ffcc1b2e2fbd3d98ff /guides/source/active_support_core_extensions.md | |
parent | c7e33c745be122eca41083a531765f7694a2e689 (diff) | |
download | rails-275065355c833b769daf898bf7940c0ff98b6a7c.tar.gz rails-275065355c833b769daf898bf7940c0ff98b6a7c.tar.bz2 rails-275065355c833b769daf898bf7940c0ff98b6a7c.zip |
Remove mentions about `Module#reachable?` in "Active Support Core Extensions" guide
Diffstat (limited to 'guides/source/active_support_core_extensions.md')
-rw-r--r-- | guides/source/active_support_core_extensions.md | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md index 1438245f9c..ae573cc77c 100644 --- a/guides/source/active_support_core_extensions.md +++ b/guides/source/active_support_core_extensions.md @@ -674,44 +674,6 @@ M.parents # => [X::Y, X, Object] NOTE: Defined in `active_support/core_ext/module/introspection.rb`. -### Reachable - -A named module is reachable if it is stored in its corresponding constant. It means you can reach the module object via the constant. - -That is what ordinarily happens, if a module is called "M", the `M` constant exists and holds it: - -```ruby -module M -end - -M.reachable? # => true -``` - -But since constants and modules are indeed kind of decoupled, module objects can become unreachable: - -```ruby -module M -end - -orphan = Object.send(:remove_const, :M) - -# The module object is orphan now but it still has a name. -orphan.name # => "M" - -# You cannot reach it via the constant M because it does not even exist. -orphan.reachable? # => false - -# Let's define a module called "M" again. -module M -end - -# The constant M exists now again, and it stores a module -# object called "M", but it is a new instance. -orphan.reachable? # => false -``` - -NOTE: Defined in `active_support/core_ext/module/reachable.rb`. - ### Anonymous A module may or may not have a name: @@ -745,7 +707,6 @@ end m = Object.send(:remove_const, :M) -m.reachable? # => false m.anonymous? # => false ``` |