The Difference Between load, autoload, require, and require_relative in Ruby
- Use
load
to pick up any changes you made to a file while the program is running.- Use
autoload
to speed up the initialization of your library by lazily loading the modules.- Use
require
when you want to use external gems.- Use
require_relative
for local files relative to the current working directory.
Source: The Difference Between load, autoload, require, and require_relative in Ruby
Huh, I could have sworn that autoload
was frowned upon and possibly even deprecated. (Something I recall Matz mentioning long ago.) Anyway, this is a good summary!