Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Gem::RemoteFetcher#cache_update_path
cache_update_path(uri, path = nil, update = true)
lib/rubygems/remote_fetcher.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/rubygems/remote_fetcher.rb, line 286
def cache_update_path(uri, path = nil, update = true)
mtime = begin
path && File.stat(path).mtime
rescue StandardError
nil
end
data = fetch_path(uri, mtime)
if data.nil? # indicates the server returned 304 Not Modified
return Gem.read_binary(path)
end
if update && path
Gem.write_binary(path, data)
end
data
end
Downloads uri to path if necessary. If no path is given, it just passes the data.