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
encoding()
click to toggle source
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
# File lib/rubocop/magic_comment.rb, line 234 def encoding super if tokens.size > 1 end
extract_typed()
click to toggle source
Vim comments cannot specify Sorbet typechecking behavior.
# File lib/rubocop/magic_comment.rb, line 245 def extract_typed; end
frozen_string_literal()
click to toggle source
Vim comments cannot specify frozen string literal behavior.
# File lib/rubocop/magic_comment.rb, line 239 def frozen_string_literal; end