Class: RuboCop::Cop::Style::ParallelAssignment::GenericCorrector

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

Overview

An internal class for correcting parallel assignment

Direct Known Subclasses

ModifierCorrector, RescueCorrector

Constant Summary

Constants included from AutocorrectAlignment

AutocorrectAlignment::SPACE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AutocorrectAlignment

#autocorrect, #check_alignment, #configured_indentation_width, #display_column, #indentation, #offset

Constructor Details

#initialize(node, config, new_elements) ⇒ GenericCorrector

Returns a new instance of GenericCorrector.



187
188
189
190
191
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 187

def initialize(node, config, new_elements)
  @node = node
  @config = config
  @new_elements = new_elements
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



185
186
187
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 185

def config
  @config
end

#nodeObject (readonly)

Returns the value of attribute node.



185
186
187
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 185

def node
  @node
end

Instance Method Details

#correctionObject



193
194
195
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 193

def correction
  assignment.join("\n#{offset(node)}")
end

#correction_rangeObject



197
198
199
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 197

def correction_range
  node.source_range
end