debian-mirror-gitlab/app/finders/repositories/branch_names_finder.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
580 B
Ruby
Raw Permalink Normal View History

2021-04-29 21:17:54 +05:30
# frozen_string_literal: true
module Repositories
class BranchNamesFinder
attr_reader :repository, :params
def initialize(repository, params = {})
@repository = repository
@params = params
end
def execute
2021-06-08 01:23:25 +05:30
return unless search && offset && limit
2021-04-29 21:17:54 +05:30
2021-06-08 01:23:25 +05:30
repository.search_branch_names(search).lazy.drop(offset).take(limit) # rubocop:disable CodeReuse/ActiveRecord
2021-04-29 21:17:54 +05:30
end
private
def search
@params[:search].presence
end
2021-06-08 01:23:25 +05:30
def offset
@params[:offset]
end
def limit
@params[:limit]
end
2021-04-29 21:17:54 +05:30
end
end