Actions
Bug #20411
closedKenrel.autoload? behaviour
Description
👋 I recently tried checking if a top-level constant was autoloaded within a module, and it doesn't seem to work properly when calling autoload?
from Kernel
. Here's a simple reproduction script:
autoload :A, "a.rb"
module B
puts Kernel.autoload?(:A) # nil
puts Module.autoload?(:A) # a.rb
end
puts Kernel.autoload?(:A) # a.rb
puts Module.autoload?(:A) # a.rb
I would expect Kernel.autoload?
and Module.autoload?
to behave the same way, and return the path of the autoloaded constant until it is loaded.
Actions
Like0
Like0Like0Like0Like0