Skip to content

Commit 8d4b28a

Browse files
author
Paweł Świątkowski
committed
Don't break when Pathname is passed to LoadedFeaturesIndex
1 parent 78be2f5 commit 8d4b28a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/bootsnap/load_path_cache/loaded_features_index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def register(short, long = nil)
133133
#
134134
# See <https://ruby-doc.org/core-2.6.4/Kernel.html#method-i-require>.
135135
def extension_elidable?(f)
136-
f.end_with?('.rb', '.so', '.o', '.dll', '.dylib')
136+
f.to_s.end_with?('.rb', '.so', '.o', '.dll', '.dylib')
137137
end
138138

139139
def strip_extension_if_elidable(f)

test/load_path_cache/loaded_features_index_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ def test_derives_initial_state_from_loaded_features
134134
assert(index.key?('minitest/autorun.rb'))
135135
refute(index.key?('minitest/autorun.so'))
136136
end
137+
138+
def test_works_with_pathname
139+
path = '/tmp/bundler.rb'
140+
pathname = Pathname.new(path)
141+
@index.register(pathname, path) { true }
142+
assert(@index.key?(pathname))
143+
end
137144
end
138145
end
139146
end

0 commit comments

Comments
 (0)