diff options
Diffstat (limited to 'lib/rubygems/custom_require.rb')
-rwxr-xr-x | lib/rubygems/custom_require.rb | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/rubygems/custom_require.rb b/lib/rubygems/custom_require.rb index 90e6b53959..78c7872b6f 100755 --- a/lib/rubygems/custom_require.rb +++ b/lib/rubygems/custom_require.rb @@ -7,11 +7,15 @@ require 'rubygems' module Kernel - alias gem_original_require require # :nodoc: - # - # We replace Ruby's require with our own, which is capable of - # loading gems on demand. + ## + # The Kernel#require from before RubyGems was loaded. + + alias gem_original_require require + + ## + # When RubyGems is required, Kernel#require is replaced with our own which + # is capable of loading gems on demand. # # When you call <tt>require 'x'</tt>, this is what happens: # * If the file can be loaded from the existing Ruby loadpath, it @@ -22,8 +26,8 @@ module Kernel # # The normal <tt>require</tt> functionality of returning false if # that file has already been loaded is preserved. - # - def require(path) # :nodoc: + + def require(path) # :doc: gem_original_require path rescue LoadError => load_error if load_error.message =~ /#{Regexp.escape path}\z/ and @@ -34,5 +38,9 @@ module Kernel raise load_error end end -end # module Kernel + + private :require + private :gem_original_require + +end |