123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: RuboCop::Cop::Style::ParallelAssignment::GenericCorrector
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

::RuboCop::Cop::Alignment - Included

SPACE

Class Method Summary

GenericCorrector - Inherited

Instance Attribute Summary

Instance Method Summary

Constructor Details

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

Instance Method Details

#correction

[ GitHub ]

  
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 272

def correction
  parent = node.parent

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

#correction_range

[ GitHub ]

  
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 281

def correction_range
  node.parent.source_range
end

#modifier_range(node) (private)

[ GitHub ]

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

def modifier_range(node)
  node.loc.keyword.join(node.source_range.end)
end