Skip to content

Commit

Permalink
Improves the internal docs of Zeitwerk::ExplicitNamespace
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Oct 13, 2024
1 parent 1ea9729 commit 1289989
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/zeitwerk/explicit_namespace.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
# frozen_string_literal: true

module Zeitwerk
# Centralizes the logic needed to descend into matching subdirectories right
# after the constant for an explicit namespace has been defined.
# This module is essentially a registry for explicit namespaces.
#
# When a loader determines that a certain file should define an explicit
# namespace, it registers it here, associating its cref with itself.
#
# If the namespace is autoloaded, our const_added callback retrieves its
# loader by calling loader_for. That way, the loader is able to scan the
# subdirectories that conform the namespace and set autoloads for their
# expected constants just in time.
#
# Once autoloaded, the namespace is unregistered.
#
# The implementation assumes an explicit namespace is managed by one loader.
# Loaders that reopen namespaces owned by other projects are responsible for
Expand Down

0 comments on commit 1289989

Please sign in to comment.