Maintenance of Ruby 2.0.0 ended on February 24, 2016. Read more

In Files

  • rubygems/path_support.rb



Class/Module Index [+]



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



The default system path for managing Gems.


Array of paths to search for Gems.

Public Class Methods

new(env=ENV) click to toggle source

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 20
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)

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

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit