1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Document $LOAD_PATH.resolve_feature_path in globals.rdoc

* RDoc does not seem to support documenting singleton object methods,
  and making $LOAD_PATH a class as a workaround is too weird.
This commit is contained in:
Benoit Daloze 2019-07-13 15:23:49 +02:00
parent b0f6f33094
commit 4a935bc6f6
3 changed files with 5 additions and 15 deletions

View file

@ -25,7 +25,10 @@ $$:: The process number of the Ruby running this script.
$?:: The status of the last executed child process. This value is $?:: The status of the last executed child process. This value is
thread-local. thread-local.
$LOAD_PATH:: Load path for scripts and binary modules by load or require. $LOAD_PATH:: Load path for scripts and binary modules by load or require.
Aliased to $: and $-I. Aliased to $: and $-I. Has a singleton method
$LOAD_PATH.resolve_feature_path(feature) that returns
[:rb or :so, path], which resolves the feature to the path the
original Kernel#require method would load.
$LOADED_FEATURES:: The array contains the module names loaded by require. $LOADED_FEATURES:: The array contains the module names loaded by require.
Aliased to $". Aliased to $".
$DEBUG:: The debug flag, which is set by the -d switch. Enabling debug $DEBUG:: The debug flag, which is set by the -d switch. Enabling debug

3
load.c
View file

@ -945,14 +945,13 @@ load_ext(VALUE path)
return (VALUE)dln_load(RSTRING_PTR(path)); return (VALUE)dln_load(RSTRING_PTR(path));
} }
/* Method is documented in vm.c */
static int static int
no_feature_p(const char *feature, const char *ext, int rb, int expanded, const char **fn) no_feature_p(const char *feature, const char *ext, int rb, int expanded, const char **fn)
{ {
return 0; return 0;
} }
// Documented in doc/globals.rdoc
VALUE VALUE
rb_resolve_feature_path(VALUE klass, VALUE fname) rb_resolve_feature_path(VALUE klass, VALUE fname)
{ {

12
vm.c
View file

@ -2937,18 +2937,6 @@ static VALUE usage_analysis_operand_stop(VALUE self);
static VALUE usage_analysis_register_stop(VALUE self); static VALUE usage_analysis_register_stop(VALUE self);
#endif #endif
/*
* Document-method: RubyVM::resolve_feature_path
* call-seq:
* RubyVM.resolve_feature_path(feature) -> [:rb or :so, path]
*
* Identifies the file that will be loaded by "require(feature)".
* This API is experimental and just for internal use.
*
* RubyVM.resolve_feature_path("set")
* #=> [:rb, "/path/to/set.rb"]
*/
void void
Init_VM(void) Init_VM(void)
{ {