Class: RuboCop::Cop::Style::ParallelAssignment::RescueCorrector
- Inherits:
-
GenericCorrector
- Object
- GenericCorrector
- RuboCop::Cop::Style::ParallelAssignment::RescueCorrector
- Defined in:
- lib/rubocop/cop/style/parallel_assignment.rb
Overview
An internal class for correcting parallel assignment protected by rescue
Constant Summary
Constants included from AutocorrectAlignment
Instance Attribute Summary
Attributes inherited from GenericCorrector
Instance Method Summary collapse
Methods inherited from GenericCorrector
Methods included from AutocorrectAlignment
#autocorrect, #check_alignment, #configured_indentation_width, #display_column, #indentation, #offset
Constructor Details
This class inherits a constructor from RuboCop::Cop::Style::ParallelAssignment::GenericCorrector
Instance Method Details
#correction ⇒ Object
201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 201 def correction _node, rescue_clause = *node.parent _, _, rescue_result = *rescue_clause "begin\n" \ "#{indentation(node)}" \ "#{assignment.join("\n#{indentation(node)}")}" \ "\n#{offset(node)}rescue\n" \ "#{indentation(node)}#{rescue_result.source}" \ "\n#{offset(node)}end" end |
#correction_range ⇒ Object
213 214 215 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 213 def correction_range node.parent.source_range end |