Class: GitlabCodeownersChecker::CodeownersFile

Inherits:
Object
  • Object
show all
Defined in:
lib/gitab_codeowners_checker/codeowners_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#pathObject (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

#patternsObject



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