Class: RuboCop::Cop::ConditionCorrector
- Inherits:
-
Object
- Object
- RuboCop::Cop::ConditionCorrector
- Defined in:
- lib/rubocop/cop/correctors/condition_corrector.rb
Overview
This class does condition autocorrection
Class Method Summary collapse
Class Method Details
.correct_negative_condition(corrector, node) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/rubocop/cop/correctors/condition_corrector.rb', line 8 def correct_negative_condition(corrector, node) condition = negated_condition(node) corrector.replace(node.loc.keyword, node.inverse_keyword) corrector.replace(condition, condition.children.first.source) end |