Class: RuboCop::Cop::ParenthesesCorrector
- Inherits:
-
Object
- Object
- RuboCop::Cop::ParenthesesCorrector
- Extended by:
- RangeHelp
- Defined in:
- lib/rubocop/cop/correctors/parentheses_corrector.rb
Overview
This autocorrects parentheses
Constant Summary collapse
- COMMA_REGEXP =
/(?<=\))\s*,/.freeze
Class Method Summary collapse
Class Method Details
.correct(corrector, node) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/rubocop/cop/correctors/parentheses_corrector.rb', line 12 def correct(corrector, node) corrector.remove(node.loc.begin) corrector.remove(node.loc.end) handle_orphaned_comma(corrector, node) return unless ternary_condition?(node) && next_char_is_question_mark?(node) corrector.insert_after(node.loc.end, ' ') end |