Class: ProtectedBranchesFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/protected_branches_finder.rb

Overview

ProtectedBranchesFinder

Used to filter protected branches by set of params

Arguments:

project - which project to scope to
params:
  search: string

Constant Summary collapse

LIMIT =
100

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, params = {}) ⇒ ProtectedBranchesFinder

Returns a new instance of ProtectedBranchesFinder.


16
17
18
19
# File 'app/finders/protected_branches_finder.rb', line 16

def initialize(project, params = {})
  @project = project
  @params = params
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params


14
15
16
# File 'app/finders/protected_branches_finder.rb', line 14

def params
  @params
end

#projectObject

Returns the value of attribute project


14
15
16
# File 'app/finders/protected_branches_finder.rb', line 14

def project
  @project
end

Instance Method Details

#executeObject


21
22
23
24
25
26
# File 'app/finders/protected_branches_finder.rb', line 21

def execute
  protected_branches = project.limited_protected_branches(LIMIT)
  protected_branches = by_name(protected_branches)

  protected_branches
end