Class: GitlabCodeownersChecker::CodeownersFile
- Inherits:
-
Object
- Object
- GitlabCodeownersChecker::CodeownersFile
- Defined in:
- lib/gitab_codeowners_checker/codeowners_file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ CodeownersFile
constructor
A new instance of CodeownersFile.
- #patterns ⇒ Object
Constructor Details
#initialize(path) ⇒ CodeownersFile
Returns a new instance of CodeownersFile.
7 8 9 |
# File 'lib/gitab_codeowners_checker/codeowners_file.rb', line 7 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/gitab_codeowners_checker/codeowners_file.rb', line 10 def path @path end |
Instance Method Details
#patterns ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/gitab_codeowners_checker/codeowners_file.rb', line 12 def patterns @patterns ||= begin File.readlines(@path).each_with_object([]) do |line, acc| acc.push(Pattern.from_file_line(line)) if contains_pattern?(line) end end end |