Require files to be loaded only once
suggest changeKernel#require loads a file only once. Later calls do not evaluate it again. A name with no directory separator is looked up in $LOAD_PATH. Extensions such as .rb and the platform's shared-library suffix (.so or .dll) can be omitted. A path such as ./file is resolved from the process's working directory.
require 'awesome_print'
Kernel#require_relative loads a file relative to the file that calls it.
# will search in directory myproj relative to current source file.
#
require_relative 'myproj/version'
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents