ruby-changes:20979
From: drbrain <ko1@a...>
Date: Tue, 23 Aug 2011 15:30:41 +0900 (JST)
Subject: [ruby-changes:20979] drbrain:r33028 (ruby_1_9_3): * backport r33027 from trunk.
drbrain 2011-08-23 15:30:30 +0900 (Tue, 23 Aug 2011) New Revision: 33028 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33028 Log: * backport r33027 from trunk. * load.c (rb_f_require): Improve documentation of Kernel#require. [Ruby 1.9 - Bug #5210] Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/load.c Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 33027) +++ ruby_1_9_3/ChangeLog (revision 33028) @@ -1,3 +1,10 @@ +Tue Aug 23 15:23:56 2011 Eric Hodel <drbrain@s...> + + * backport r33027 from trunk. + + * load.c (rb_f_require): Improve documentation of Kernel#require. + [Ruby 1.9 - Bug #5210] + Tue Aug 23 15:11:48 2011 Hiroshi Nakamura <nahi@r...> * backport r33023 from trunk. Index: ruby_1_9_3/load.c =================================================================== --- ruby_1_9_3/load.c (revision 33027) +++ ruby_1_9_3/load.c (revision 33028) @@ -430,24 +430,33 @@ /* * call-seq: - * require(string) -> true or false + * require(name) -> true or false * - * Ruby tries to load the library named _string_, returning - * +true+ if successful. If the filename does not resolve to - * an absolute path, it will be searched for in the directories listed - * in <code>$:</code>. If the file has the extension ``.rb'', it is - * loaded as a source file; if the extension is ``.so'', ``.o'', or - * ``.dll'', or whatever the default shared library extension is on - * the current platform, Ruby loads the shared library as a Ruby - * extension. Otherwise, Ruby tries adding ``.rb'', ``.so'', and so on - * to the name. The name of the loaded feature is added to the array in - * <code>$"</code>. A feature will not be loaded if its name already - * appears in <code>$"</code>. The file name is converted to an absolute - * path, so ``<code>require 'a'; require './a'</code>'' will not load - * <code>a.rb</code> twice. + * Loads the given +name+, returning +true+ if successful and +false+ if the + * feature is already loaded. * - * require "my-library.rb" - * require "db-driver" + * 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 has the extension ".rb", it is loaded as a source file; if + * the extension is ".so", ".o", or ".dll", or the default shared library + * extension on the current platform, Ruby loads the shared library as a + * Ruby extension. Otherwise, Ruby tries adding ".rb", ".so", and so on + * to the name until found. If the file named cannot be found, a LoadError + * will be raised. + * + * For Ruby extensions the filename given may use any shared library + * extension. For example, on Linux the socket extension is "socket.so" and + * <code>require 'socket.dll'</code> will load the socket extension. + * + * The absolute path of the loaded file is added to + * <code>$LOADED_FEATURES</code> (<code>$"</code>). A file will not be + * loaded again if its path already appears in <code>$"</code>. For example, + * <code>require 'a'; require './a'</code> will not load <code>a.rb</code> + * again. + * + * require "my-library.rb" + * require "db-driver" */ VALUE -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/