class RuboCop::MagicComment::EditorComment

@abstract
Parent to Vim and Emacs magic comment handling.

def match(keyword)

Returns:
  • (nil) - otherwise
  • (String) - extracted value if it is found

Parameters:
  • keyword (String) --
def match(keyword)
  pattern = /\A#{keyword}\s*#{self.class::OPERATOR}\s*(#{TOKEN})\z/
  tokens.each do |token|
    next unless (value = token[pattern, 1])
    return value.downcase
  end
  nil
end

def tokens

Returns:
  • (Array) -
def tokens
  extract(self.class::FORMAT).split(self.class::SEPARATOR).map(&:strip)
end