1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Improve readability by splitting updating the cache and searching it

https://github.com/rubygems/rubygems/commit/d0df25bb0f
This commit is contained in:
David Rodriguez 2021-10-21 20:28:02 +02:00 committed by Hiroshi SHIBATA
parent f7f85c1feb
commit 7073870dfa
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -357,7 +357,10 @@ module Bundler
end
def cached_path(spec)
possibilities = (@caches << download_cache_path(spec)).compact.map {|p| "#{p}/#{spec.file_name}" }
global_cache_path = download_cache_path(spec)
@caches << global_cache_path if global_cache_path
possibilities = @caches.map {|p| "#{p}/#{spec.file_name}" }
possibilities.find {|p| File.exist?(p) }
end