class Zeitwerk::Loader

def for_gem_extension(namespace)

@sig (bool) -> Zeitwerk::GemLoader

is private, client code can only rely on the interface.
This method returns a subclass of Zeitwerk::Loader, but the exact type

the same file, in the unlikely case the gem wants to be able to reload.
except that this method returns the same object in subsequent calls from

loader.push_dir(__dir__, namespace: namespace)
loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
loader.tag = namespace.name + "-" + File.basename(__FILE__, ".rb")
loader = Zeitwerk::Loader.new

require "zeitwerk"

This is a shortcut for
def for_gem_extension(namespace)
  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, "extending anonymous namespaces is unsupported"
  end
  called_from = caller_locations(1, 1).first.path
  Registry.loader_for_gem(called_from, namespace: namespace, warn_on_extra_files: false)
end