class RuboCop::MagicComment::VimComment
Wrapper for Vim style magic comments.
@example Vim style comment
comment = RuboCop::MagicComment.parse( '# vim: filetype=ruby, fileencoding=ascii-8bit' ) comment.encoding # => 'ascii-8bit'
Constants
- FORMAT
- KEYWORDS
- OPERATOR
- REGEXP
- SEPARATOR
Public Instance Methods
Source
# File lib/rubocop/magic_comment.rb, line 238 def encoding super if tokens.size > 1 end
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
Calls superclass method
RuboCop::MagicComment::EditorComment#encoding
Source
# File lib/rubocop/magic_comment.rb, line 249 def extract_typed; end
Vim comments cannot specify Sorbet typechecking behavior.
Source
# File lib/rubocop/magic_comment.rb, line 243 def frozen_string_literal; end
Vim comments cannot specify frozen string literal behavior.