aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2012-09-06 13:43:49 +0200
committerXavier Noria <fxn@hashref.com>2012-09-06 13:43:49 +0200
commit021cb85b95e46f825876ddb28b7d31338cc9288c (patch)
treed5d9374a57e7a3c709f39acbe0e3827d6f6ac1ab /activesupport
parent3ee191fd95584dc984ee76486a932a54419156d2 (diff)
downloadrails-021cb85b95e46f825876ddb28b7d31338cc9288c.tar.gz
rails-021cb85b95e46f825876ddb28b7d31338cc9288c.tar.bz2
rails-021cb85b95e46f825876ddb28b7d31338cc9288c.zip
restores awesome comment
Those who say source code should be without comments lie.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/dependencies.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index ab96538fdf..ad34567fb6 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -460,6 +460,25 @@ module ActiveSupport #:nodoc:
# const_missing must be due to from_mod::const_name, which should not
# return constants from from_mod's parents.
begin
+ # Since Ruby does not pass the nesting at the point the unknown
+ # constant triggered the callback we cannot fully emulate constant
+ # name lookup and need to make a trade-off: we are going to assume
+ # that the nesting in the body of Foo::Bar is [Foo::Bar, Foo] even
+ # though it might not be. Counterexamples are
+ #
+ # class Foo::Bar
+ # Module.nesting # => [Foo::Bar]
+ # end
+ #
+ # or
+ #
+ # module M::N
+ # module S::T
+ # Module.nesting # => [S::T, M::N]
+ # end
+ # end
+ #
+ # for example.
return parent.const_missing(const_name)
rescue NameError => e
raise unless e.missing_name? qualified_name_for(parent, const_name)