End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Kernel#autoload?
autoload?(name, inherit=true) → String or nil
load.c
View on GitHub ↗
static VALUE
rb_f_autoload_p(int argc, VALUE *argv, VALUE obj)
{
/* use rb_vm_cbase() as same as rb_f_autoload. */
VALUE klass = rb_vm_cbase();
if (NIL_P(klass)) {
return Qnil;
}
return rb_mod_autoload_p(argc, argv, klass);
}
Returns filename to be loaded if name is registered as autoload.
Example
autoload(:B, "b") autoload?(:B) #=> "b"