Class: ProtectedBranchesFinder
- Inherits:
-
Object
- Object
- ProtectedBranchesFinder
- 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
-
#params ⇒ Object
Returns the value of attribute params.
-
#project_or_group ⇒ Object
Returns the value of attribute project_or_group.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project_or_group, params = {}) ⇒ ProtectedBranchesFinder
constructor
A new instance of ProtectedBranchesFinder.
Constructor Details
#initialize(project_or_group, params = {}) ⇒ ProtectedBranchesFinder
Returns a new instance of ProtectedBranchesFinder.
16 17 18 19 |
# File 'app/finders/protected_branches_finder.rb', line 16 def initialize(project_or_group, params = {}) @project_or_group = project_or_group @params = params end |
Instance Attribute Details
#params ⇒ Object
Returns the value of attribute params.
14 15 16 |
# File 'app/finders/protected_branches_finder.rb', line 14 def params @params end |
#project_or_group ⇒ Object
Returns the value of attribute project_or_group.
14 15 16 |
# File 'app/finders/protected_branches_finder.rb', line 14 def project_or_group @project_or_group end |
Instance Method Details
#execute ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/finders/protected_branches_finder.rb', line 21 def execute protected_branches = if project_or_group.is_a?(Group) project_or_group.protected_branches else project_or_group.all_protected_branches end protected_branches = protected_branches.limit(LIMIT) by_name(protected_branches) end |