Class: RuboCop::MagicComment::EmacsComment

Inherits:
EditorComment 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; frozen_string_literal: true -*-'
)

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

See Also:

Constant Summary collapse

FORMAT =
/\-\*\-(.+)\-\*\-/
SEPARATOR =
';'.freeze
OPERATOR =
':'.freeze

Constants inherited from RuboCop::MagicComment

TOKEN

Instance Method Summary collapse

Methods inherited from RuboCop::MagicComment

#frozen_string_literal, #frozen_string_literal?, #frozen_string_literal_specified?, #initialize, parse

Constructor Details

This class inherits a constructor from RuboCop::MagicComment

Instance Method Details

#encodingObject



125
126
127
# File 'lib/rubocop/magic_comment.rb', line 125

def encoding
  match('encoding')
end