Skip to content

Commit

Permalink
Make the private shadowed_file? internal
Browse files Browse the repository at this point in the history
  • Loading branch information
fxn committed Feb 10, 2023
1 parent 88905f1 commit 4acfd42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions lib/zeitwerk/loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,8 @@ def unregister
# The return value of this predicate is only meaningful if the loader has
# scanned the file. This is the case in the spots where we use it.
#
# @private
# @sig (String) -> Boolean
def shadowed_file?(file)
internal def shadowed_file?(file)
shadowed_files.member?(file)
end

Expand Down
10 changes: 5 additions & 5 deletions test/lib/zeitwerk/test_shadowed_files.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TestShadowedFiles < LoaderTest

files = [["x.rb", "X = 2"]]
with_setup(files) do
assert loader.shadowed_file?(File.expand_path("x.rb"))
assert loader.__shadowed_file?(File.expand_path("x.rb"))

assert_equal 1, ::X
loader.reload
Expand All @@ -25,8 +25,8 @@ class TestShadowedFiles < LoaderTest
loader.push_dir("b")
loader.setup

assert !loader.shadowed_file?(File.expand_path("a/x.rb"))
assert loader.shadowed_file?(File.expand_path("b/x.rb"))
assert !loader.__shadowed_file?(File.expand_path("a/x.rb"))
assert loader.__shadowed_file?(File.expand_path("b/x.rb"))

assert_equal 1, ::X
loader.reload
Expand All @@ -40,8 +40,8 @@ class TestShadowedFiles < LoaderTest
first_loader = new_loader(dirs: "a")
second_loader = new_loader(dirs: "b")

assert !first_loader.shadowed_file?(File.expand_path("a/x.rb"))
assert second_loader.shadowed_file?(File.expand_path("b/x.rb"))
assert !first_loader.__shadowed_file?(File.expand_path("a/x.rb"))
assert second_loader.__shadowed_file?(File.expand_path("b/x.rb"))

assert_equal 1, ::X
second_loader.reload
Expand Down

0 comments on commit 4acfd42

Please sign in to comment.