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

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

Overview

An internal class for correcting parallel assignment

Direct Known Subclasses

ModifierCorrector, RescueCorrector

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node, config, new_elements) ⇒ GenericCorrector

Returns a new instance of GenericCorrector.



181
182
183
184
185
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 181

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.



179
180
181
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 179

def config
  @config
end

#nodeObject (readonly)

Returns the value of attribute node.



179
180
181
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 179

def node
  @node
end

Instance Method Details

#correctionObject



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

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

#correction_rangeObject



191
192
193
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 191

def correction_range
  node.source_range
end