new(sources = nil)
public
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.
# File 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