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-4.0.0/lib/rubygems/remote_fetcher.rb, line 290
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.