Skip to content

Commit ffb161b

Browse files
Prefer reverse+find to select+last
1 parent 9d878cb commit ffb161b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bundler/lib/bundler/lazy_specification.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ def __materialize__(platform)
9696
else
9797
source.specs.search(self)
9898
end
99-
installable_candidates = candidates.select do |spec|
99+
best_installable_candidate = candidates.reverse.find do |spec|
100100
spec.is_a?(StubSpecification) ||
101101
(spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
102102
spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
103103
end
104-
search = installable_candidates.last || candidates.last
104+
search = best_installable_candidate || candidates.last
105105
search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
106106
search
107107
end

0 commit comments

Comments
 (0)