Class: RuboCop::MagicComment::EmacsComment

Inherits:
EditorComment
  • Object
show all
Defined in:
lib/rubocop/magic_comment.rb

Overview

Wrapper for Emacs style magic comments.

Examples:

Emacs style comment

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

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

See Also:

Constant Summary collapse

REGEXP =
/-\*-(?<token>.+)-\*-/.freeze
FORMAT =
'# -*- %s -*-'
SEPARATOR =
';'
OPERATOR =
':'

Instance Method Summary collapse

Methods inherited from EditorComment

#encoding, #without

Instance Method Details

#new_frozen_string_literal(value) ⇒ Object



206
207
208
# File 'lib/rubocop/magic_comment.rb', line 206

def new_frozen_string_literal(value)
  "# -*- frozen_string_literal: #{value} -*-"
end