Require files to be loaded only once

suggest change

The Kernel#require method will load files only once (several calls to require will result in the code in that file being evaluated only once). It will search your ruby $LOAD_PATH to find the required file if the parameter is not an absolute path. Extensions like .rb, .so, .o or .dll are optional. Relative paths will be resolved to the current working directory of the process.

require 'awesome_print'

The Kernel#require_relative allows you to load files relative to the file in which require_relative is called.

# will search in directory myproj relative to current source file.
#
require_relative 'myproj/version'

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents