class Zeitwerk::Loader
def autoload_subdir(parent, cname, subdir)
def autoload_subdir(parent, cname, subdir) oload_path = autoload_path_set_by_me_for?(parent, cname) h = cpath(parent, cname) uby?(autoload_path) Scanning visited a Ruby file first, and now a directory for the same constant has been found. This means we are dealing with an explicit namespace whose definition was seen first. Registering is idempotent, and we have to keep the autoload pointing to the file. This may run again if more directories are found later on, no big deal. gister_explicit_namespace(cpath) the existing autoload points to a file, it has to be preserved, if t, it is fine as it is. In either case, we do not need to override. st remember the subdirectory conforms this namespace. space_dirs[cpath] << subdir !cdef?(parent, cname) rst time we find this namespace, set an autoload for it. space_dirs[cpath(parent, cname)] << subdir ne_autoload(parent, cname, subdir) r whatever reason the constant that corresponds to this namespace has ready been defined, we have to recurse. "the namespace #{cpath(parent, cname)} already exists, descending into #{subdir}") if logger ne_autoloads_for_dir(subdir, cget(parent, cname))