blob: 8c8c74054078d4c25ca741aa641f2d0d54c9069f (
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
29
30
31
32
|
# frozen_string_literal: true
module Repositories
class BranchNamesFinder
attr_reader :repository, :params
def initialize(repository, params = {})
@repository = repository
@params = params
end
def execute
return unless search && offset && limit
repository.search_branch_names(search).lazy.drop(offset).take(limit) # rubocop:disable CodeReuse/ActiveRecord
end
private
def search
@params[:search].presence
end
def offset
@params[:offset]
end
def limit
@params[:limit]
end
end
end
|