aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/module/introspection.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-01-12 12:17:24 -0800
committerXavier Noria <fxn@hashref.com>2012-01-12 12:17:35 -0800
commit04df7bb02c8a267ec7cd1c20ba20a49a24cffb2f (patch)
treefeeaaada1aef0e1055bd1626274dfd7a49d0e29d /activesupport/lib/active_support/core_ext/module/introspection.rb
parent3c64548859a9e778bc6f5b0bdb796dc1b5136c3d (diff)
downloadrails-04df7bb02c8a267ec7cd1c20ba20a49a24cffb2f.tar.gz
rails-04df7bb02c8a267ec7cd1c20ba20a49a24cffb2f.tar.bz2
rails-04df7bb02c8a267ec7cd1c20ba20a49a24cffb2f.zip
deprecates Module#local_constant_names
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/introspection.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/module/introspection.rb14
1 files changed, 12 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 1893a9cfa6..743db47bac 100644
--- a/activesupport/lib/active_support/core_ext/module/introspection.rb
+++ b/activesupport/lib/active_support/core_ext/module/introspection.rb
@@ -61,9 +61,19 @@ class Module
constants(false)
end
- # Returns the names of the constants defined locally rather than the
- # constants themselves. See <tt>local_constants</tt>.
+ # *DEPRECATED*: Use +local_constants+ instead.
+ #
+ # Returns the names of the constants defined locally as strings.
+ #
+ # module M
+ # X = 1
+ # end
+ # M.local_constant_names # => ["X"]
+ #
+ # This method is useful for forward compatibility, since Ruby 1.8 returns
+ # constant names as strings, whereas 1.9 returns them as symbols.
def local_constant_names
+ ActiveSupport::Deprecation.warn('Module#local_constant_names is deprecated, use Module#local_constants instead', caller)
local_constants.map { |c| c.to_s }
end
end