Automatically loading source files
suggest changeKernel#autoload registers a filename to be loaded (using Kernel#require) the first time the named constant is accessed. The name may be a String or a Symbol.
autoload :MyModule, '/usr/local/lib/modules/my_module.rb'
Kernel#autoload? returns the filename to load if the name is registered with autoload.
autoload? :MyModule #=> '/usr/local/lib/modules/my_module.rb'
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents