Class: Codeowners::Ownership
- Inherits:
-
Object
- Object
- Codeowners::Ownership
- Extended by:
- Forwardable
- Defined in:
- lib/codeowners/ownership.rb
Overview
The Ownership class represents an codeowners rule from a GitHub CODEOWNERS file. It includes methods to filter files matching the path expression and to check codeowners.
Instance Attribute Summary collapse
-
#glob ⇒ Ownership::Glob
readonly
The path expression from the CODEOWNERS file.
-
#owners ⇒ Array<Codeowners::Owner>
readonly
The owners (team name) from the CODEOWNERS file.
Instance Method Summary collapse
-
#initialize(glob, *owners) ⇒ Ownership
constructor
Initializes a new Ownership instance.
-
#owner?(owner_name) ⇒ Boolean
Checks if a given owner name matches the owner of this path expression.
Constructor Details
Instance Attribute Details
#glob ⇒ Ownership::Glob (readonly)
Returns The path expression from the CODEOWNERS file.
16 17 18 |
# File 'lib/codeowners/ownership.rb', line 16 def glob @glob end |
#owners ⇒ Array<Codeowners::Owner> (readonly)
Returns The owners (team name) from the CODEOWNERS file.
19 20 21 |
# File 'lib/codeowners/ownership.rb', line 19 def owners @owners end |
Instance Method Details
#owner?(owner_name) ⇒ Boolean
Checks if a given owner name matches the owner of this path expression
34 35 36 |
# File 'lib/codeowners/ownership.rb', line 34 def owner?(owner_name) owners.any? { |owner| owner.match?(owner_name) } end |