Class: Projects::BranchRule
- Inherits:
-
Object
- Object
- Projects::BranchRule
- Extended by:
- Forwardable
- Defined in:
- app/models/projects/branch_rule.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#protected_branch ⇒ Object
readonly
Returns the value of attribute protected_branch.
Instance Method Summary collapse
- #branch_protection ⇒ Object
-
#initialize(project, protected_branch) ⇒ BranchRule
constructor
A new instance of BranchRule.
- #matching_branches_count ⇒ Object
- #protected? ⇒ Boolean
Constructor Details
#initialize(project, protected_branch) ⇒ BranchRule
Returns a new instance of BranchRule.
11 12 13 14 |
# File 'app/models/projects/branch_rule.rb', line 11 def initialize(project, protected_branch) @protected_branch = protected_branch @project = project end |
Instance Attribute Details
#project ⇒ Object (readonly)
Returns the value of attribute project.
7 8 9 |
# File 'app/models/projects/branch_rule.rb', line 7 def project @project end |
#protected_branch ⇒ Object (readonly)
Returns the value of attribute protected_branch.
7 8 9 |
# File 'app/models/projects/branch_rule.rb', line 7 def protected_branch @protected_branch end |
Instance Method Details
#branch_protection ⇒ Object
26 27 28 |
# File 'app/models/projects/branch_rule.rb', line 26 def branch_protection protected_branch end |
#matching_branches_count ⇒ Object
20 21 22 23 24 |
# File 'app/models/projects/branch_rule.rb', line 20 def matching_branches_count branch_names = project.repository.branch_names matching_branches = protected_branch.matching(branch_names) matching_branches.count end |
#protected? ⇒ Boolean
16 17 18 |
# File 'app/models/projects/branch_rule.rb', line 16 def protected? true end |