module Zeitwerk::Loader::Config

def push_dir(path, namespace: Object)

: (String | Pathname, namespace: Module) -> void ! Zeitwerk::Error

descendants.
the same process already manages that directory or one of its ascendants or
Raises `Zeitwerk::Error` if `path` does not exist, or if another loader in

Pushes `path` to the list of root directories.
def push_dir(path, namespace: Object)
  unless namespace.is_a?(Module) # Note that Class < Module.
    raise Zeitwerk::Error, "#{namespace.inspect} is not a class or module object, should be"
  end
  unless real_mod_name(namespace)
    raise Zeitwerk::Error, "root namespaces cannot be anonymous"
  end
  abspath = File.expand_path(path)
  if dir?(abspath)
    raise_if_conflicting_directory(abspath)
    roots[abspath] = namespace
  else
    raise Zeitwerk::Error, "the root directory #{abspath} does not exist"
  end
end