Class: RuboCop::Cop::Style::UnlessCorrector

Inherits:
Object
  • Object
show all
Extended by:
ConditionalAssignmentHelper, ConditionalCorrectorHelper
Defined in:
lib/rubocop/cop/style/conditional_assignment.rb

Overview

Corrector to correct conditional assignment in ‘unless` statements.

Constant Summary

Constants included from ConditionalAssignmentHelper

ConditionalAssignmentHelper::ALIGN_WITH, ConditionalAssignmentHelper::END_ALIGNMENT, ConditionalAssignmentHelper::EQUAL, ConditionalAssignmentHelper::KEYWORD

Class Method Summary collapse

Methods included from ConditionalCorrectorHelper

assignment, correct_branches, correct_if_branches, remove_whitespace_in_branches, replace_branch_assignment, white_space_range

Methods included from ConditionalAssignmentHelper

end_with_eq?, expand_elses, expand_when_branches, indent, lhs, tail

Methods included from NodePattern::Macros

#def_node_matcher, #def_node_search, #node_search, #node_search_all, #node_search_body, #node_search_first

Class Method Details

.correct(cop, node) ⇒ Object



681
682
683
# File 'lib/rubocop/cop/style/conditional_assignment.rb', line 681

def correct(cop, node)
  ->(corrector) { correct_if_branches(corrector, cop, node) }
end