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
222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 222 def correction _node, rescue_clause = *node.parent _, _, rescue_result = *rescue_clause # If the parallel assignment uses a rescue modifier and it is the # only contents of a method, then we want to make use of the # implicit begin if node.parent.parent && node.parent.parent.def_type? super + def_correction(rescue_result) else begin_correction(rescue_result) end end |
#correction_range ⇒ Object
236 237 238 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 236 def correction_range node.parent.source_range end |