# frozen_string_literal: true require_relative './pattern' module GitlabCodeownersChecker class CodeownersFile def initialize(path) @path = path end attr_reader :path 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 private def contains_pattern?(str) str.include?('@') end end end