Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
class method
Gem.paths=
(::Gem::_HashLike[::String, ::String?] env) -> ::Array[::String]
paths=(env)
lib/rubygems.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/rubygems.rb, line 360
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 <<-EOWARN
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]}
EOWARN
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
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.