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."
Written by Rex Chung
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby require
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#