Maintenance Ruby 3.4 gets fixes, but no new features. 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-3.4.1/lib/rubygems/remote_fetcher.rb, line 97
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.