[前][次][番号順一覧][スレッド一覧]

ruby-changes:56432

From: Benoit <ko1@a...>
Date: Sat, 13 Jul 2019 22:35:57 +0900 (JST)
Subject: [ruby-changes:56432] Benoit Daloze: 4a935bc6f6 (master): Document $LOAD_PATH.resolve_feature_path in globals.rdoc

https://git.ruby-lang.org/ruby.git/commit/?id=4a935bc6f6

From 4a935bc6f66fda448fb430c7627a2f175dcd0650 Mon Sep 17 00:00:00 2001
From: Benoit Daloze <eregontp@g...>
Date: Sat, 13 Jul 2019 15:23:49 +0200
Subject: 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.

diff --git a/doc/globals.rdoc b/doc/globals.rdoc
index 96030ea..284f3d7 100644
--- a/doc/globals.rdoc
+++ b/doc/globals.rdoc
@@ -25,7 +25,10 @@ $$::   The process number of the Ruby running this script. https://github.com/ruby/ruby/blob/trunk/doc/globals.rdoc#L25
 $?::   The status of the last executed child process.  This value is
        thread-local.
 $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.
                      Aliased to $".
 $DEBUG::     The debug flag, which is set by the -d switch.  Enabling debug
diff --git a/load.c b/load.c
index 4eb3f7f..539b29f 100644
--- a/load.c
+++ b/load.c
@@ -945,14 +945,13 @@ load_ext(VALUE path) https://github.com/ruby/ruby/blob/trunk/load.c#L945
     return (VALUE)dln_load(RSTRING_PTR(path));
 }
 
-/* Method is documented in vm.c */
-
 static int
 no_feature_p(const char *feature, const char *ext, int rb, int expanded, const char **fn)
 {
     return 0;
 }
 
+// Documented in doc/globals.rdoc
 VALUE
 rb_resolve_feature_path(VALUE klass, VALUE fname)
 {
diff --git a/vm.c b/vm.c
index 09e727f..b5412d1 100644
--- a/vm.c
+++ b/vm.c
@@ -2937,18 +2937,6 @@ static VALUE usage_analysis_operand_stop(VALUE self); https://github.com/ruby/ruby/blob/trunk/vm.c#L2937
 static VALUE usage_analysis_register_stop(VALUE self);
 #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
 Init_VM(void)
 {
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]