ruby-changes:61423
From: Nobuyoshi <ko1@a...>
Date: Sat, 30 May 2020 01:09:54 +0900 (JST)
Subject: [ruby-changes:61423] 0d30f42813 (master): [DOC] mentioned "explicit relative path" [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=0d30f42813 From 0d30f42813716f837ca39d74657f7f715042e820 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sat, 30 May 2020 00:57:09 +0900 Subject: [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. diff --git a/load.c b/load.c index f917a73..0ee59b5 100644 --- a/load.c +++ b/load.c @@ -678,14 +678,17 @@ rb_load_protect(VALUE fname, int wrap, int *pstate) https://github.com/ruby/ruby/blob/trunk/load.c#L678 * call-seq: * load(filename, wrap=false) -> true * - * Loads and executes the Ruby - * program in the file _filename_. If the filename does not - * resolve to an absolute path, the file is searched for in the library - * directories listed in <code>$:</code>. If the optional _wrap_ - * parameter is +true+, the loaded script will 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. + * Loads and executes the Ruby program in the file _filename_. + * + * If the filename neither resolve to an absolute path, or start with + * './' or '../', the file is searched for in the library directories + * listed in <code>$:</code>. + * + * If the optional _wrap_ parameter is +true+, the loaded script will + * 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 @@ -783,8 +786,9 @@ load_unlock(const char *ftptr, int done) https://github.com/ruby/ruby/blob/trunk/load.c#L786 * Loads the given +name+, returning +true+ if successful and +false+ if the * feature is already loaded. * - * If the filename does not resolve to an absolute path, it will be searched - * for in the directories listed in <code>$LOAD_PATH</code> (<code>$:</code>). + * If the filename neither resolve to an absolute path, or start with + * './' 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 * the extension is ".so", ".o", or ".dll", or the default shared library -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/