mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Deduplicate results just once
Instead of checking for uniqueness for every spec. https://github.com/rubygems/rubygems/commit/97d28c9665
This commit is contained in:
parent
75d90cc8e5
commit
2aa8edaec7
1 changed files with 3 additions and 10 deletions
|
@ -58,19 +58,12 @@ module Bundler
|
|||
# about, returning all of the results.
|
||||
def search(query)
|
||||
results = local_search(query)
|
||||
|
||||
seen = results.map(&:full_name).uniq unless @sources.empty?
|
||||
return results unless @sources.any?
|
||||
|
||||
@sources.each do |source|
|
||||
source.search(query).each do |spec|
|
||||
next if seen.include?(spec.full_name)
|
||||
|
||||
seen << spec.full_name
|
||||
results << spec
|
||||
end
|
||||
results.concat(source.search(query))
|
||||
end
|
||||
|
||||
results
|
||||
results.uniq(&:full_name)
|
||||
end
|
||||
|
||||
def local_search(query)
|
||||
|
|
Loading…
Reference in a new issue