debian-mirror-gitlab/app/services/search/snippet_service.rb

22 lines
461 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2015-04-26 12:48:37 +05:30
module Search
class SnippetService
attr_accessor :current_user, :params
def initialize(user, params)
@current_user, @params = user, params.dup
end
def execute
2017-08-17 22:00:37 +05:30
snippets = SnippetsFinder.new(current_user).execute
2016-06-02 11:05:42 +05:30
Gitlab::SnippetSearchResults.new(snippets, params[:search])
2015-04-26 12:48:37 +05:30
end
2017-08-17 22:00:37 +05:30
def scope
@scope ||= %w[snippet_titles].delete(params[:scope]) { 'snippet_blobs' }
end
2015-04-26 12:48:37 +05:30
end
end