Merge pull request #15278 from akshay-vishnoi/doc_changes

[ci skip] Improve doc for ModuleConstMissing.guess_for_anonymous
This commit is contained in:
Andrew White 2014-05-24 13:15:34 +01:00
commit b850c4c540
1 changed files with 5 additions and 4 deletions

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"