[DOC] mentioned "explicit relative path" [ci skip]

`Kernel#.require` and `Kernel#.load` do not search also "explicit
relative path" files, not only absolute paths, in the load path.
This commit is contained in:
Nobuyoshi Nakada 2020-05-30 00:57:09 +09:00
parent 2c8821c0d2
commit 0d30f42813
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6

24
load.c
View File

@ -678,14 +678,17 @@ rb_load_protect(VALUE fname, int wrap, int *pstate)
* call-seq: * call-seq:
* load(filename, wrap=false) -> true * load(filename, wrap=false) -> true
* *
* Loads and executes the Ruby * Loads and executes the Ruby program in the file _filename_.
* program in the file _filename_. If the filename does not *
* resolve to an absolute path, the file is searched for in the library * If the filename neither resolve to an absolute path, or start with
* directories listed in <code>$:</code>. If the optional _wrap_ * './' or '../', the file is searched for in the library directories
* parameter is +true+, the loaded script will be executed * listed in <code>$:</code>.
* under an anonymous module, protecting the calling program's global *
* namespace. In no circumstance will any local variables in the loaded * If the optional _wrap_ parameter is +true+, the loaded script will
* file be propagated to the loading environment. * be executed under an anonymous module, protecting the calling
* program's global namespace. In no circumstance will any local
* variables in the loaded file be propagated to the loading
* environment.
*/ */
static VALUE static VALUE
@ -783,8 +786,9 @@ load_unlock(const char *ftptr, int done)
* Loads the given +name+, returning +true+ if successful and +false+ if the * Loads the given +name+, returning +true+ if successful and +false+ if the
* feature is already loaded. * feature is already loaded.
* *
* If the filename does not resolve to an absolute path, it will be searched * If the filename neither resolve to an absolute path, or start with
* for in the directories listed in <code>$LOAD_PATH</code> (<code>$:</code>). * './' or '../', it will be searched for in the directories listed
* in <code>$LOAD_PATH</code> (<code>$:</code>).
* *
* If the filename has the extension ".rb", it is loaded as a source file; if * If the filename has the extension ".rb", it is loaded as a source file; if
* the extension is ".so", ".o", or ".dll", or the default shared library * the extension is ".so", ".o", or ".dll", or the default shared library