Initialize the filesystem paths to use
from env. env is a hash-like object (typically ENV) that is queried for ‘GEM_HOME’,
‘GEM_PATH’, and ‘GEM_SPEC_CACHE’ Keys for the env hash
should be Strings, and values of the hash should be Strings or
nil.
# File lib/rubygems.rb, line 386
def self.paths=(env)
clear_paths
target = {}
env.each_pair do |k,v|
case k
when 'GEM_HOME', 'GEM_PATH', 'GEM_SPEC_CACHE'
case v
when nil, String
target[k] = v
when Array
unless Gem::Deprecate.skip
warn Array values in the parameter to `Gem.paths=` are deprecated.Please use a String or nil.An Array (#{env.inspect}) was passed in from #{caller[3]}
end
target[k] = v.join File::PATH_SEPARATOR
end
else
target[k] = v
end
end
@paths = Gem::PathSupport.new ENV.to_hash.merge(target)
Gem::Specification.dirs = @paths.path
end