Class: RuboCop::Cop::Style::ParallelAssignment::ModifierCorrector
- Inherits:
-
GenericCorrector
- Object
- GenericCorrector
- RuboCop::Cop::Style::ParallelAssignment::ModifierCorrector
- Defined in:
- lib/rubocop/cop/style/parallel_assignment.rb
Overview
An internal class for correcting parallel assignment guarded by if, unless, while, or until
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, #indentation, #offset, #start_of_line?
Constructor Details
This class inherits a constructor from RuboCop::Cop::Style::ParallelAssignment::GenericCorrector
Instance Method Details
#correction ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 156 def correction parent = node.parent modifier_range = Parser::Source::Range.new(parent.loc.expression.source_buffer, parent.loc.keyword.begin_pos, parent.loc.expression.end_pos) "#{modifier_range.source}\n" << indentation(node) << assignment.join("\n#{indentation(node)}") << "\n#{offset(node)}end" end |
#correction_range ⇒ Object
169 170 171 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 169 def correction_range node.parent.loc.expression end |