Class: RuboCop::MagicComment::EditorComment Abstract
- Inherits:
-
MagicComment
- Object
- MagicComment
- RuboCop::MagicComment::EditorComment
- Defined in:
- lib/rubocop/magic_comment.rb
Overview
This class is abstract.
Parent to Vim and Emacs magic comment handling.
Direct Known Subclasses
Instance Method Summary collapse
- #encoding ⇒ Object
-
#without(type) ⇒ Object
Rewrite the comment without a given token type.
Instance Method Details
#encoding ⇒ Object
149 150 151 |
# File 'lib/rubocop/magic_comment.rb', line 149 def encoding match(self.class::KEYWORDS[:encoding]) end |
#without(type) ⇒ Object
Rewrite the comment without a given token type
154 155 156 157 158 159 |
# File 'lib/rubocop/magic_comment.rb', line 154 def without(type) remaining = tokens.grep_v(/\A#{self.class::KEYWORDS[type.to_sym]}/) return '' if remaining.empty? self.class::FORMAT % remaining.join(self.class::SEPARATOR) end |