ruby-changes:72778
From: David <ko1@a...>
Date: Tue, 2 Aug 2022 16:10:41 +0900 (JST)
Subject: [ruby-changes:72778] 5487e76374 (master): [rubygems/rubygems] Prefer reverse+find to select+last
https://git.ruby-lang.org/ruby.git/commit/?id=5487e76374 From 5487e76374c5ee247b0f5a2867a6dc1319d98e0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Fri, 29 Jul 2022 21:17:59 +0200 Subject: [rubygems/rubygems] Prefer reverse+find to select+last https://github.com/rubygems/rubygems/commit/ffb161bb69 --- lib/bundler/lazy_specification.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 4a7f528119..7245692546 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -96,12 +96,12 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/lazy_specification.rb#L96 else source.specs.search(self) end - installable_candidates = candidates.select do |spec| + best_installable_candidate = candidates.reverse.find do |spec| spec.is_a?(StubSpecification) || (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) && spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version)) end - search = installable_candidates.last || candidates.last + search = best_installable_candidate || candidates.last search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification)) search end -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/