1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

[ci skip] Improve doc for ModuleConstMissing.guess_for_anonymous

This commit is contained in:
Akshay Vishnoi 2014-05-24 06:41:16 +05:30
parent 2fdddcee6f
commit 3f829a8394

View file

@ -180,10 +180,11 @@ module ActiveSupport #:nodoc:
Dependencies.load_missing_constant(from_mod, const_name)
end
# Dependencies assumes the name of the module reflects the nesting (unless
# it can be proven that is not the case), and the path to the file that
# defines the constant. Anonymous modules cannot follow these conventions
# and we assume therefore the user wants to refer to a top-level constant.
# We assume that the name of the module reflects the nesting
# (unless it can be proven that is not the case) and the path to the file
# that defines the constant. Anonymous modules cannot follow these
# conventions and therefore we assume that the user wants to refer to a
# top-level constant.
def guess_for_anonymous(const_name)
if Object.const_defined?(const_name)
raise NameError, "#{const_name} cannot be autoloaded from an anonymous class or module"