Class: Gem::PathSupport (Ruby 2.3.4)

In Files

  • rubygems/path_support.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

Gem::PathSupport

frozen_string_literal: true

Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings to the rest of RubyGems.

Attributes

home[R]

The default system path for managing Gems.

path[R]

Array of paths to search for Gems.

Public Class Methods

new(env=ENV)

Constructor. Takes a single argument which is to be treated like a hashtable, or defaults to ENV, the system environment.

 
               # File rubygems/path_support.rb, line 25
def initialize(env=ENV)
  @env = env

  # note 'env' vs 'ENV'...
  @home     = env["GEM_HOME"] || ENV["GEM_HOME"] || Gem.default_dir

  if File::ALT_SEPARATOR then
    @home   = @home.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
  end

  self.path = env["GEM_PATH"] || ENV["GEM_PATH"]

  @spec_cache_dir =
    env["GEM_SPEC_CACHE"] || ENV["GEM_SPEC_CACHE"] ||
      Gem.default_spec_cache_dir

  @spec_cache_dir = @spec_cache_dir.dup.untaint
end