Class: RuboCop::Cop::Style::ParallelAssignment::ModifierCorrector

Inherits:
GenericCorrector
  • Object
show all
Defined in:
lib/rubocop/cop/style/parallel_assignment.rb

Overview

An internal class for correcting parallel assignment guarded by if, unless, while, or until

Instance Attribute Summary

Attributes inherited from GenericCorrector

#config, #node, #rescue_result, #rhs

Instance Method Summary collapse

Methods inherited from GenericCorrector

#initialize

Constructor Details

This class inherits a constructor from RuboCop::Cop::Style::ParallelAssignment::GenericCorrector

Instance Method Details

#correctionObject



277
278
279
280
281
282
283
284
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 277

def correction
  parent = node.parent

  "#{modifier_range(parent).source}\n" \
    "#{indentation(node)}" \
    "#{assignment.join("\n#{indentation(node)}")}" \
    "\n#{offset(node)}end"
end

#correction_rangeObject



286
287
288
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 286

def correction_range
  node.parent.source_range
end