Class: RuboCop::Cop::ParenthesesCorrector

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/cop/correctors/parentheses_corrector.rb

Overview

This auto-corrects parentheses

Class Method Summary collapse

Class Method Details

.correct(corrector, node) ⇒ Object


8
9
10
11
12
13
14
# File 'lib/rubocop/cop/correctors/parentheses_corrector.rb', line 8

def correct(corrector, node)
  corrector.remove(node.loc.begin)
  corrector.remove(node.loc.end)
  return unless ternary_condition?(node) && next_char_is_question_mark?(node)

  corrector.insert_after(node.loc.end, ' ')
end