Skip to content

Commit

Permalink
Make on_dir_autoloaded internal
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Sep 17, 2023
1 parent 53c27f9 commit 7f56fa8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/zeitwerk/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def require(path)
loader.__on_file_autoloaded(path) if required
required
else
loader.on_dir_autoloaded(path)
loader.__on_dir_autoloaded(path)
true
end
else
Expand Down
3 changes: 1 addition & 2 deletions lib/zeitwerk/loader/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ module Zeitwerk::Loader::Callbacks
# Invoked from our decorated Kernel#require when a managed directory is
# autoloaded.
#
# @private
# @sig (String) -> void
def on_dir_autoloaded(dir)
internal def on_dir_autoloaded(dir)
# Module#autoload does not serialize concurrent requires in CRuby < 3.2, and
# we handle directories ourselves without going through Kernel#require, so
# the callback needs to account for concurrency.
Expand Down
4 changes: 2 additions & 2 deletions test/lib/zeitwerk/test_callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def loader.__on_file_autoloaded(file)
end

test "autoloading a directory triggers on_dir_autoloaded (Object)" do
def loader.on_dir_autoloaded(dir)
def loader.__on_dir_autoloaded(dir)
if dir == File.expand_path("m")
$on_dir_autoloaded_called = true
end
Expand All @@ -94,7 +94,7 @@ def loader.on_dir_autoloaded(dir)
end

test "autoloading a directory triggers on_dir_autoloaded (Namespace)" do
def loader.on_dir_autoloaded(dir)
def loader.__on_dir_autoloaded(dir)
if dir == File.expand_path("m")
$on_dir_autoloaded_called = true
end
Expand Down

0 comments on commit 7f56fa8

Please sign in to comment.