Skip to content

Commit

Permalink
Add workaround for truffleruby 24.1.0 issue
Browse files Browse the repository at this point in the history
* See oracle/truffleruby#3683
* Without this the test suite has 6 failures, 26 errors.
  • Loading branch information
eregon committed Oct 12, 2024
1 parent c65a782 commit 7db993d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/zeitwerk/real_mod_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@ module Zeitwerk::RealModName
# The name method can be overridden, hence the indirection in this method.
#
# @sig (Module) -> String?
def real_mod_name(mod)
UNBOUND_METHOD_MODULE_NAME.bind_call(mod)
if RUBY_ENGINE == 'truffleruby' && (RUBY_ENGINE_VERSION.split('.').map(&:to_i) <=> [24, 2, 0]) < 0
def real_mod_name(mod)
name = UNBOUND_METHOD_MODULE_NAME.bind_call(mod)
# https://github.com/oracle/truffleruby/issues/3683
if name && name.start_with?('Object::')
name = name[8..-1]
end
name
end
else
def real_mod_name(mod)
UNBOUND_METHOD_MODULE_NAME.bind_call(mod)
end
end
end

0 comments on commit 7db993d

Please sign in to comment.