Module | Kernel |
In: |
lib/rubygems/custom_require.rb
|
require | -> | gem_original_require |
The Kernel#require from before RubyGems was loaded. |
When RubyGems is required, Kernel#require is replaced with our own which is capable of loading gems on demand.
When you call require ‘x‘, this is what happens:
The normal require functionality of returning false if that file has already been loaded is preserved.
# File lib/rubygems/custom_require.rb, line 28 28: def require(path) # :doc: 29: gem_original_require path 30: rescue LoadError => load_error 31: if load_error.message.end_with?(path) and Gem.try_activate(path) then 32: return gem_original_require(path) 33: end 34: 35: raise load_error 36: end