class method
Gem::SpecFetcher.new
new(sources = nil)
lib/rubygems/spec_fetcher.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/rubygems/spec_fetcher.rb, line 57
def initialize(sources = nil)
@sources = sources || Gem.sources
@update_cache =
begin
File.stat(Gem.user_home).uid == Process.uid
rescue Errno::EACCES, Errno::ENOENT
false
end
@specs = {}
@latest_specs = {}
@prerelease_specs = {}
@caches = {
latest: @latest_specs,
prerelease: @prerelease_specs,
released: @specs,
}
@fetcher = Gem::RemoteFetcher.fetcher
end
Creates a new SpecFetcher. Ordinarily you want to use the default fetcher from Gem::SpecFetcher::fetcher which uses the Gem.sources.
If you need to retrieve specifications from a different source, you can send it as an argument.