Method: RuboCop::Cop::Style::InverseMethods#correct_inverse_selector

Defined in:
lib/rubocop/cop/style/inverse_methods.rb

#correct_inverse_selector(block, corrector) ⇒ Object



112
113
114
115
116
117
118
119
120
121
# File 'lib/rubocop/cop/style/inverse_methods.rb', line 112

def correct_inverse_selector(block, corrector)
  selector = block.loc.selector.source

  if NEGATED_EQUALITY_METHODS.include?(selector.to_sym)
    selector[0] = '='
    corrector.replace(block.loc.selector, selector)
  else
    corrector.remove(block.loc.selector)
  end
end