Added extra doco on our require method.

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-12-30 11:05:29 -08:00
parent d7bae9de30
commit 07631a53e7

View file

@ -8,6 +8,26 @@ module Inspec
# It is used whenever the `require 'lib'` is not in libraries.
alias __ruby_require require
##
# This is our own require override, to be used in
# LibraryEvalContext and ControlEvalContext.
#
# Any top level libraries file (autoloaded) that requires a
# second-level libraries file.
#
# in load_libraries
# in top level libraries file to be autoloaded
# that has a require to a known file that is NOT loaded yet
#
# ProfileContext#initialize
# -> library_eval_context
#
# ProfileContext#load_libraries autoload
# -> load_library_file(@library_eval_context)
#
# probably most of this comment is useless, but it was hard to
# discover so I'm adding it for others.
def require(path)
rbpath = path + ".rb"
return __ruby_require(path) unless @require_loader.exists?(rbpath)