Welcome to mirror list, hosted at ThFree Co, Russian Federation.

empty_search_results.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 71a78cb297b3ed3c1ae8b87e4177024139d765fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Gitlab
  # This class has the same interface as SearchResults except
  # it is empty and does not do any work.
  #
  # We use this when responding to abusive search requests.
  class EmptySearchResults
    def initialize(*)
    end

    def objects(*)
      Kaminari.paginate_array([])
    end

    def formatted_count(*)
      '0'
    end

    def highlight_map(*)
      {}
    end

    def aggregations(*)
      []
    end
  end
end