Skip to content

Commit

Permalink
Prefer reverse+find to select+last
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Jul 30, 2022
1 parent 9d878cb commit ffb161b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bundler/lib/bundler/lazy_specification.rb
Expand Up @@ -96,12 +96,12 @@ def __materialize__(platform)
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
Expand Down

0 comments on commit ffb161b

Please sign in to comment.