Class: RuboCop::MagicComment::EmacsComment
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
|
|
|
Instance Chain:
|
|
| Inherits: |
RuboCop::MagicComment::EditorComment
|
| Defined in: | lib/rubocop/magic_comment.rb |
Overview
Wrapper for Emacs style magic comments.
Constant Summary
-
FORMAT =
# File 'lib/rubocop/magic_comment.rb', line 192'# -*- %s -*-' -
OPERATOR =
# File 'lib/rubocop/magic_comment.rb', line 194':' -
REGEXP =
# File 'lib/rubocop/magic_comment.rb', line 191/-\*-(?<token>.+)-\*-/.freeze
-
SEPARATOR =
# File 'lib/rubocop/magic_comment.rb', line 193';'
::RuboCop::MagicComment - Inherited
Class Method Summary
::RuboCop::MagicComment - Inherited
Instance Attribute Summary
::RuboCop::MagicComment - Inherited
| #any?, #encoding_specified?, | |
| #frozen_string_literal? | Does the magic comment enable the frozen string literal feature. |
| #frozen_string_literal_specified? | Was a magic comment for the frozen string literal found? |
| #shareable_constant_value_specified? | Was a shareable_constant_value specified? |
| #typed_specified? | Was the Sorbet #typed sigil specified? |
| #valid?, #valid_literal_value?, #valid_shareable_constant_value? | |
Instance Method Summary
- #new_frozen_string_literal(value)
- #extract_frozen_string_literal private
- #extract_shareable_constant_value private
-
#extract_typed
private
Emacs comments cannot specify Sorbet typechecking behavior.
EditorComment - Inherited
| #encoding, | |
| #without | Rewrite the comment without a given token type. |
| #match | Find a token starting with the provided keyword and extract its value. |
| #tokens | Individual tokens composing an editor specific comment string. |
::RuboCop::MagicComment - Inherited
| #frozen_string_literal | Expose the #frozen_string_literal value coerced to a boolean if possible. |
| #shareable_constant_value | Expose the #shareable_constant_value value coerced to a boolean if possible. |
| #typed, | |
| #extract | Match the entire comment string with a pattern and take the first capture. |
| #specified? | |
Constructor Details
This class inherits a constructor from RuboCop::MagicComment
Instance Method Details
#extract_frozen_string_literal (private)
[ GitHub ]# File 'lib/rubocop/magic_comment.rb', line 202
def extract_frozen_string_literal match(KEYWORDS[:frozen_string_literal]) end
#extract_typed (private)
Emacs comments cannot specify Sorbet typechecking behavior.
# File 'lib/rubocop/magic_comment.rb', line 211
def extract_typed; end
#new_frozen_string_literal(value)
[ GitHub ]# File 'lib/rubocop/magic_comment.rb', line 196
def new_frozen_string_literal(value) "# -*- frozen_string_literal: #{value} -*-" end