Last Updated: February 25, 2016
·
512
· rorcraft

require vs load

require would not find files with non .rb extensions.
load is designed to include scripts and config files with non .rb extension.

Matz's explanation:
"require is to load "libraries", where load is to load "scripts". The target of the load method might be configuration files, or anything else from the specified path, but at least they are all Ruby scripts. On the other hand, the require method loads Ruby libraries or dynamic loading C implemented libraries reside in the load path. So it needs file path extension to distinguish which kind of library to read."