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, rhs, modifier, config, new_elements) ⇒ GenericCorrector

Returns a new instance of GenericCorrector.



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

def initialize(node, rhs, modifier, config, new_elements)
  @node = node
  @rhs = rhs
  _, _, @rescue_result = *modifier
  @config = config
  @new_elements = new_elements
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

#nodeObject (readonly)

Returns the value of attribute node.



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

def node
  @node
end

#rescue_resultObject (readonly)

Returns the value of attribute rescue_result.



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

def rescue_result
  @rescue_result
end

#rhsObject (readonly)

Returns the value of attribute rhs.



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

def rhs
  @rhs
end

Instance Method Details

#correctionObject



203
204
205
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 203

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

#correction_rangeObject



207
208
209
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 207

def correction_range
  node.source_range
end