Skip to content

Commit 14cff5e

Browse files
committed
Refactor cpath validation for TruffleRuby
1 parent 8c26393 commit 14cff5e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/zeitwerk/loader/constant_path_validator.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class Zeitwerk::Loader::ConstantPathValidator # :nodoc
88
#
99
#: (String) -> String ! NameError
1010
def validate!(possible_cpath)
11+
# We do this before validating because as of this writing, TruffleRuby
12+
# raises TypeError if the argument has leading colons.
13+
possible_cpath = possible_cpath.delete_prefix('::')
1114
CNAME_VALIDATOR.const_defined?(possible_cpath, false)
12-
possible_cpath.delete_prefix('::')
15+
possible_cpath
1316
end
1417
end

0 commit comments

Comments
 (0)