Class: RuboCop::MagicComment::VimComment
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 Vim style magic comments.
Constant Summary
-
FORMAT =
# File 'lib/rubocop/magic_comment.rb', line 220'# vim: %s'
-
KEYWORDS =
# File 'lib/rubocop/magic_comment.rb', line 223MagicComment::KEYWORDS.merge(encoding: 'fileencoding').freeze
-
OPERATOR =
# File 'lib/rubocop/magic_comment.rb', line 222'='
-
REGEXP =
# File 'lib/rubocop/magic_comment.rb', line 219/#\s*vim:\s*(?<token>.+)/.freeze
-
SEPARATOR =
# File 'lib/rubocop/magic_comment.rb', line 221', '
::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
-
#encoding
For some reason the fileencoding keyword only works if there is at least one other token included in the string.
-
#extract_typed
Vim comments cannot specify Sorbet typechecking behavior.
-
#frozen_string_literal
Vim comments cannot specify frozen string literal behavior.
-
#shareable_constant_value
Vim comments cannot specify shareable constant values 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
#encoding
For some reason the fileencoding keyword only works if there is at least one other token included in the string. For example
# works
# vim: foo=bar, fileencoding=ascii-8bit
# does nothing
# vim: foo=bar, fileencoding=ascii-8bit
# File 'lib/rubocop/magic_comment.rb', line 234
def encoding super if tokens.size > 1 end
#extract_typed
Vim comments cannot specify Sorbet typechecking behavior.
# File 'lib/rubocop/magic_comment.rb', line 245
def extract_typed; end
#frozen_string_literal
Vim comments cannot specify frozen string literal behavior.
# File 'lib/rubocop/magic_comment.rb', line 239
def frozen_string_literal; end