Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
Gem::RemoteFetcher#download_to_cache
download_to_cache(dependency)
lib/rubygems/remote_fetcher.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems/remote_fetcher.rb, line 102
def download_to_cache(dependency)
found, _ = Gem::SpecFetcher.fetcher.spec_for_dependency dependency
return if found.empty?
spec, source = found.max_by {|(s,_)| s.version }
download spec, source.uri
end
Given a name and requirement, downloads this gem into cache and returns the filename. Returns nil if the gem cannot be located.
See also
#download
#ensure_writable_cache_dir
#close_all
#fetch_file
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0