aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-03-01 14:40:17 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-03-01 14:40:17 -0300
commit56f3bbc5b0920e44fcac83ed2d38eb90b3744183 (patch)
tree63709bb5c06903fab44db557f33dfbf71e557856 /activesupport/lib/active_support
parentbc57930e09d20ee2cdc4b5aa7200b155ba755f22 (diff)
parent86d4e189580e84c4b7effc0c3ebd25b4e8dc4fee (diff)
downloadrails-56f3bbc5b0920e44fcac83ed2d38eb90b3744183.tar.gz
rails-56f3bbc5b0920e44fcac83ed2d38eb90b3744183.tar.bz2
rails-56f3bbc5b0920e44fcac83ed2d38eb90b3744183.zip
Merge pull request #23936 from yui-knk/local_constants_to_be_public
Deprecate `Module.local_constants`
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/module/introspection.rb4
-rw-r--r--activesupport/lib/active_support/dependencies.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/introspection.rb b/activesupport/lib/active_support/core_ext/module/introspection.rb
index f1d26ef28f..fa692e1b0e 100644
--- a/activesupport/lib/active_support/core_ext/module/introspection.rb
+++ b/activesupport/lib/active_support/core_ext/module/introspection.rb
@@ -57,6 +57,10 @@ class Module
end
def local_constants #:nodoc:
+ ActiveSupport::Deprecation.warn(<<-MSG.squish)
+ Module#local_constants is deprecated and will be removed in Rails 5.1.
+ Use Module#constants(false) instead.
+ MSG
constants(false)
end
end
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index fd9fbff96a..0da01b0fe8 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -143,7 +143,7 @@ module ActiveSupport #:nodoc:
next unless mod.is_a?(Module)
# Get a list of the constants that were added
- new_constants = mod.local_constants - original_constants
+ new_constants = mod.constants(false) - original_constants
# @stack[namespace] returns an Array of the constants that are being evaluated
# for that namespace. For instance, if parent.rb requires child.rb, the first
@@ -171,7 +171,7 @@ module ActiveSupport #:nodoc:
@watching << namespaces.map do |namespace|
module_name = Dependencies.to_constant_name(namespace)
original_constants = Dependencies.qualified_const_defined?(module_name) ?
- Inflector.constantize(module_name).local_constants : []
+ Inflector.constantize(module_name).constants(false) : []
@stack[module_name] << original_constants
module_name