Class: RuboCop::Cop::Style::ParallelAssignment::GenericCorrector
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/rubocop/cop/style/parallel_assignment.rb |
Overview
An internal class for correcting parallel assignment
Constant Summary
::RuboCop::Cop::Alignment
- Included
Class Method Summary
Instance Attribute Summary
- #config readonly
- #node readonly
- #rescue_result readonly
- #rhs readonly
::RuboCop::Cop::Alignment
- Included
Instance Method Summary
- #correction
- #correction_range
- #cop_config private
- #extract_sources(node) private
- #source(node, loc) private
::RuboCop::Cop::Alignment
- Included
Constructor Details
.new(node, rhs, modifier, config, new_elements) ⇒ GenericCorrector
Instance Attribute Details
#config (readonly)
[ GitHub ]# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 188
attr_reader :node, :rhs, :rescue_result, :config
#node (readonly)
[ GitHub ]# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 188
attr_reader :node, :rhs, :rescue_result, :config
#rescue_result (readonly)
[ GitHub ]#rhs (readonly)
[ GitHub ]# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 188
attr_reader :node, :rhs, :rescue_result, :config
Instance Method Details
#cop_config (private)
[ GitHub ]# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 229
def cop_config @config.for_cop('Style/ParallelAssignment') end
#correction
[ GitHub ]# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 198
def correction assignment.join("\n#{offset(node)}") end
#correction_range
[ GitHub ]# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 202
def correction_range node.source_range end
#extract_sources(node) (private)
[ GitHub ]#source(node, loc) (private)
[ GitHub ]# File 'lib/rubocop/cop/style/parallel_assignment.rb', line 214
def source(node, loc) # __FILE__ is treated as a StrNode but has no begin if node.str_type? && loc.respond_to?(:begin) && loc.begin.nil? "'#{node.source}'" elsif node.sym_type? && loc.begin.nil? ":#{node.source}" else node.source end end