Class: RuboCop::MagicComment::EditorComment Abstract
- Inherits:
-
RuboCop::MagicComment
- Object
- RuboCop::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
Constant Summary
Constants inherited from RuboCop::MagicComment
Instance Method Summary collapse
- #encoding ⇒ Object
-
#without(type) ⇒ Object
Rewrite the comment without a given token type.
Methods inherited from RuboCop::MagicComment
#any?, #encoding_specified?, #frozen_string_literal, #frozen_string_literal?, #frozen_string_literal_specified?, #initialize, parse, #shareable_constant_value, #shareable_constant_value_specified?, #typed, #typed_specified?, #valid?, #valid_literal_value?, #valid_shareable_constant_value?
Constructor Details
This class inherits a constructor from RuboCop::MagicComment
Instance Method Details
#encoding ⇒ Object
139 140 141 |
# File 'lib/rubocop/magic_comment.rb', line 139 def encoding match(self.class::KEYWORDS[:encoding]) end |
#without(type) ⇒ Object
Rewrite the comment without a given token type
144 145 146 147 148 149 |
# File 'lib/rubocop/magic_comment.rb', line 144 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 |