From 7073870dfaa31581b2ff6787224712ad6bdd2f15 Mon Sep 17 00:00:00 2001 From: David Rodriguez Date: Thu, 21 Oct 2021 20:28:02 +0200 Subject: [PATCH] [rubygems/rubygems] Improve readability by splitting updating the cache and searching it https://github.com/rubygems/rubygems/commit/d0df25bb0f --- lib/bundler/source/rubygems.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index d0cfb07e18..11b506b324 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -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