codeowners-checker icon indicating copy to clipboard operation
codeowners-checker copied to clipboard

Refactor `Line`

Open mpapis opened this issue 6 years ago • 0 comments

Rationale

Right now descendant's of Line use parse in initialize (mostly Pattern) and the initialize method always takes a raw line as param. Because of this we can not initialize the Pattern with pattern, *owners and always need to parse.

Possible solution

Move the parse to be class method so in Line.build would call return klass.parse(line) if klass.match?(line) and for patterns Pattern.parse would call Pattern.new(pattern, *owners) and now Pattern.new becomes available for building pattern lines.

mpapis avatar Mar 25 '19 11:03 mpapis