module Zeitwerk::ExplicitNamespace

def disable_tracer_if_unneeded

@sig () -> void
def disable_tracer_if_unneeded
synchronize do
er.disable if cpaths.empty?

def register(cpath, loader)

@sig (String, Zeitwerk::Loader) -> void

is responsible.
Asserts `cpath` corresponds to an explicit namespace for which `loader`
def register(cpath, loader)
ynchronize do
s[cpath] = loader
check enabled? because, looking at the C source code, enabling an
bled tracer does not seem to be a simple no-op.
r.enable unless tracer.enabled?

def registered?(cpath)

@sig (String) -> bool

This is an internal method only used by the test suite.
def registered?(cpath)
key?(cpath)

def tracepoint_class_callback(event)

@sig (TracePoint) -> void
def tracepoint_class_callback(event)
he class is a singleton class, we won't do anything with it so we
bail out immediately. This is several orders of magnitude faster
 accessing its name.
 if event.self.singleton_class?
ight be tempting to return if name.nil?, to avoid the computation
 hash code and delete call. But Ruby does not trigger the :class
t on Class.new or Module.new, so that would incur in an extra call
nothing.
he other hand, if we were called, cpaths is not empty. Otherwise
tracer is disabled. So we do need to go ahead with the hash code
utation and delete call.
der = cpaths.delete(real_mod_name(event.self))
er.on_namespace_loaded(event.self)
ble_tracer_if_unneeded

def unregister_loader(loader)

@sig (Zeitwerk::Loader) -> void
def unregister_loader(loader)
delete_if { |_cpath, l| l == loader }
_tracer_if_unneeded