Class: RuboCop::Cop::Style::ParallelAssignment::GenericCorrector
- Inherits:
-
Object
- Object
- RuboCop::Cop::Style::ParallelAssignment::GenericCorrector
- Includes:
- Alignment
- Defined in:
- lib/rubocop/cop/style/parallel_assignment.rb
Overview
An internal class for correcting parallel assignment
Direct Known Subclasses
Constant Summary
Constants included from Alignment
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#rescue_result ⇒ Object
readonly
Returns the value of attribute rescue_result.
-
#rhs ⇒ Object
readonly
Returns the value of attribute rhs.
Instance Method Summary collapse
- #correction ⇒ Object
- #correction_range ⇒ Object
-
#initialize(node, rhs, modifier, config, new_elements) ⇒ GenericCorrector
constructor
A new instance of GenericCorrector.
Constructor Details
#initialize(node, rhs, modifier, config, new_elements) ⇒ GenericCorrector
Returns a new instance of GenericCorrector.
198 199 200 201 202 203 204 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 198 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
#config ⇒ Object (readonly)
Returns the value of attribute config.
196 197 198 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 196 def config @config end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
196 197 198 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 196 def node @node end |
#rescue_result ⇒ Object (readonly)
Returns the value of attribute rescue_result.
196 197 198 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 196 def rescue_result @rescue_result end |
#rhs ⇒ Object (readonly)
Returns the value of attribute rhs.
196 197 198 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 196 def rhs @rhs end |
Instance Method Details
#correction ⇒ Object
206 207 208 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 206 def correction assignment.join("\n#{offset(node)}") end |
#correction_range ⇒ Object
210 211 212 |
# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 210 def correction_range node.source_range end |