class RuboCop::MagicComment::SimpleComment

comment2.encoding # => ‘utf-8’
comment2.frozen_string_literal # => nil
comment2 = RuboCop::MagicComment.parse(‘# encoding: utf-8’)
@example encoding comments
comment1.encoding # => nil
comment1.frozen_string_literal # => true
comment1 = RuboCop::MagicComment.parse(‘# frozen_string_literal: true’)
@example frozen string literal comments
Simple comments can only specify one setting per comment.
Wrapper for regular magic comments not bound to an editor.

def encoding

Match `encoding` or `coding`
def encoding
  extract(/\b(?:en)?coding: (#{TOKEN})/)
end

def extract_frozen_string_literal

is the only text in the comment.
The `frozen_string_literal` magic comment only works if it

Extract `frozen_string_literal`.
def extract_frozen_string_literal
  extract(/^#\s*frozen_string_literal:\s*(#{TOKEN})\s*$/)
end