diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2012-04-28 20:18:26 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2012-04-28 20:18:26 -0700 |
commit | 1a4e27ff96b3b7add1a4a43ca757ea8ee6c05c00 (patch) | |
tree | 03e64efa0e3a307c0f8f58eadc31fc01e26b1cd7 /activesupport/lib/active_support/core_ext/module/introspection.rb | |
parent | ad2c5ea2786817592014fae09934398173c1a7f9 (diff) | |
parent | 432a65fab2a6c7eb6ff77062e73f7627470f7da7 (diff) | |
download | rails-1a4e27ff96b3b7add1a4a43ca757ea8ee6c05c00.tar.gz rails-1a4e27ff96b3b7add1a4a43ca757ea8ee6c05c00.tar.bz2 rails-1a4e27ff96b3b7add1a4a43ca757ea8ee6c05c00.zip |
Merge pull request #5996 from gazay/remove_excess_selfs
Active Support housekeeping and polish
Diffstat (limited to 'activesupport/lib/active_support/core_ext/module/introspection.rb')
-rw-r--r-- | activesupport/lib/active_support/core_ext/module/introspection.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/module/introspection.rb b/activesupport/lib/active_support/core_ext/module/introspection.rb index 743db47bac..3c8e811fa4 100644 --- a/activesupport/lib/active_support/core_ext/module/introspection.rb +++ b/activesupport/lib/active_support/core_ext/module/introspection.rb @@ -5,10 +5,11 @@ class Module # # M::N.parent_name # => "M" def parent_name - unless defined? @parent_name + if defined? @parent_name + @parent_name + else @parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : nil end - @parent_name end # Returns the module which contains this one according to its name. @@ -73,7 +74,7 @@ class Module # 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) + ActiveSupport::Deprecation.warn 'Module#local_constant_names is deprecated, use Module#local_constants instead', caller local_constants.map { |c| c.to_s } end end |