class Codeowners::Checker::Group::Comment

Define and manage comment line.

Public Class Methods

match?(line) click to toggle source

Matches if the line is a comment. @return [Boolean] if the line start with `#`

# File lib/codeowners/checker/group/comment.rb, line 12
def self.match?(line)
  line.start_with?('#')
end

Public Instance Methods

level() click to toggle source

Return the comment level if the comment works like a markdown headers. @return [Integer] with the heading level.

@example

Comment.new('# First level').level # => 1
Comment.new('## Second').level # => 2
# File lib/codeowners/checker/group/comment.rb, line 23
def level
  (@line[/^#+/] || '').size
end