Class: Codeowners::Checker::Group::Line
- Inherits:
-
Object
- Object
- Codeowners::Checker::Group::Line
show all
- Defined in:
- lib/codeowners/checker/group/line.rb
Overview
It sorts lines from CODEOWNERS file to different line types and holds shared methods for all lines.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(line) ⇒ Line
Returns a new instance of Line.
23
24
25
|
# File 'lib/codeowners/checker/group/line.rb', line 23
def initialize(line)
@line = line
end
|
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
10
11
12
|
# File 'lib/codeowners/checker/group/line.rb', line 10
def parent
@parent
end
|
Class Method Details
.build(line) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/codeowners/checker/group/line.rb', line 12
def self.build(line)
subclasses.each do |klass|
return klass.new(line) if klass.match?(line)
end
UnrecognizedLine.new(line)
end
|
Instance Method Details
#<=>(other) ⇒ Object
58
59
60
|
# File 'lib/codeowners/checker/group/line.rb', line 58
def <=>(other)
to_s <=> other.to_s
end
|
#==(other) ⇒ Object
52
53
54
55
56
|
# File 'lib/codeowners/checker/group/line.rb', line 52
def ==(other)
return false unless other.is_a?(self.class)
other.to_s == to_s
end
|
#pattern? ⇒ Boolean
39
40
41
|
# File 'lib/codeowners/checker/group/line.rb', line 39
def pattern?
is_a?(Pattern)
end
|
#remove! ⇒ Object
47
48
49
50
|
# File 'lib/codeowners/checker/group/line.rb', line 47
def remove!
parent&.remove(self)
self.parent = nil
end
|
#to_content ⇒ Object
31
32
33
|
# File 'lib/codeowners/checker/group/line.rb', line 31
def to_content
to_s
end
|
#to_file ⇒ Object
35
36
37
|
# File 'lib/codeowners/checker/group/line.rb', line 35
def to_file
to_s
end
|
#to_s ⇒ Object
27
28
29
|
# File 'lib/codeowners/checker/group/line.rb', line 27
def to_s
@line
end
|
#to_tree(indentation) ⇒ Object
43
44
45
|
# File 'lib/codeowners/checker/group/line.rb', line 43
def to_tree(indentation)
indentation + to_s
end
|