Class: RuboCop::MagicComment::VimComment
- Inherits:
-
EditorComment
- Object
- MagicComment
- EditorComment
- RuboCop::MagicComment::VimComment
- Defined in:
- lib/rubocop/magic_comment.rb
Overview
Wrapper for Vim style magic comments.
Constant Summary collapse
- REGEXP =
/#\s*vim:\s*(?<token>.+)/.freeze
- FORMAT =
'# vim: %s'- SEPARATOR =
', '- OPERATOR =
'='- KEYWORDS =
MagicComment::KEYWORDS.merge(encoding: 'fileencoding').freeze
Instance Method Summary collapse
-
#encoding ⇒ Object
For some reason the fileencoding keyword only works if there is at least one other token included in the string.
-
#extract_rbs_inline_value ⇒ Object
Vim comments cannot specify RBS::inline behavior.
-
#extract_typed ⇒ Object
Vim comments cannot specify Sorbet typechecking behavior.
-
#frozen_string_literal ⇒ Object
Vim comments cannot specify frozen string literal behavior.
-
#shareable_constant_value ⇒ Object
Vim comments cannot specify shareable constant values behavior.
Methods inherited from EditorComment
Instance Method Details
#encoding ⇒ Object
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
251 252 253 |
# File 'lib/rubocop/magic_comment.rb', line 251 def encoding super if tokens.size > 1 end |
#extract_rbs_inline_value ⇒ Object
Vim comments cannot specify RBS::inline behavior.
259 |
# File 'lib/rubocop/magic_comment.rb', line 259 def extract_rbs_inline_value; end |
#extract_typed ⇒ Object
Vim comments cannot specify Sorbet typechecking behavior.
265 |
# File 'lib/rubocop/magic_comment.rb', line 265 def extract_typed; end |
#frozen_string_literal ⇒ Object
Vim comments cannot specify frozen string literal behavior.
256 |
# File 'lib/rubocop/magic_comment.rb', line 256 def frozen_string_literal; end |
#shareable_constant_value ⇒ Object
Vim comments cannot specify shareable constant values behavior.
262 |
# File 'lib/rubocop/magic_comment.rb', line 262 def shareable_constant_value; end |