class RuboCop::MagicComment::EmacsComment

Wrapper for Emacs style magic comments.

@example Emacs style comment

comment = RuboCop::MagicComment.parse(
  '# -*- encoding: ASCII-8BIT -*-'
)

comment.encoding # => 'ascii-8bit'

@see www.gnu.org/software/emacs/manual/html_node/emacs/Specify-Coding.html @see github.com/ruby/ruby/blob/3f306dc/parse.y#L6873-L6892 Emacs handling in parse.y

Constants

FORMAT
OPERATOR
REGEXP
SEPARATOR

Private Instance Methods

extract_frozen_string_literal() click to toggle source
# File lib/rubocop/magic_comment.rb, line 198
def extract_frozen_string_literal
  match(KEYWORDS[:frozen_string_literal])
end
extract_shareable_constant_value() click to toggle source
# File lib/rubocop/magic_comment.rb, line 202
def extract_shareable_constant_value
  match(KEYWORDS[:shareable_constant_value])
end
extract_typed() click to toggle source

Emacs comments cannot specify Sorbet typechecking behavior.

# File lib/rubocop/magic_comment.rb, line 207
def extract_typed; end