Module | Kernel |
In: |
lib/rubygems/open-uri.rb
lib/rubygems/custom_require.rb lib/rubygems.rb |
open | -> | rubygems_open_uri_original_open |
require | -> | gem_original_require |
Adds a Ruby Gem to the $LOAD_PATH. Before a Gem is loaded, its required Gems are loaded. If the version information is omitted, the highest version Gem of the supplied name is loaded. If a Gem is not found that meets the version requirement and/or a required Gem is not found, a Gem::LoadError is raised. More information on version requirements can be found in the Gem::Version documentation.
The gem directive should be executed before any require statements (otherwise rubygems might select a conflicting library version).
You can define the environment variable GEM_SKIP as a way to not load specified gems. you might do this to test out changes that haven‘t been intsalled yet. Example:
GEM_SKIP=libA:libB ruby-I../libA -I../libB ./mycode.rb
gem: | [String or Gem::Dependency] The gem name or dependency instance. |
version_requirement: | [default=">= 0.0.0"] The version requirement. |
return: | [Boolean] true if the Gem is loaded, otherwise false. |
raises: | [Gem::LoadError] if Gem cannot be found, is listed in GEM_SKIP, or version requirement not met. |
makes possible to open various resources including URIs. If the first argument respond to `open’ method, the method is called with the rest arguments.
If the first argument is a string which begins with xxx://, it is parsed by URI.parse. If the parsed object respond to `open’ method, the method is called with the rest arguments.
Otherwise original open is called.
Since open-uri.rb provides URI::HTTP#open, URI::HTTPS#open and URI::FTP#open, Kernel[#.]open can accepts such URIs and strings which begins with http://, https:// and ftp://. In these case, the opened file object is extended by OpenURI::Meta.