autoload(p1, p2)
public
Registers filename to be loaded (using Kernel::require) the first
time that module (which may be a String
or a symbol) is accessed.
autoload(:MyModule, "/usr/local/lib/modules/my_module.rb")
Show source
static VALUE
rb_f_autoload(VALUE obj, VALUE sym, VALUE file)
{
VALUE klass = rb_class_real(rb_vm_cbase());
if (NIL_P(klass)) {
rb_raise(rb_eTypeError, "Can not set autoload on singleton class");
}
return rb_mod_autoload(klass, sym, file);
}