Class: RuboCop::Cop::Legacy::Corrector

Inherits:
Corrector
  • Object
show all
Defined in:
lib/rubocop/cop/legacy/corrector.rb

Overview

Legacy Corrector for v0 API support. See docs.rubocop.org/rubocop/cop_api_v1_changelog.html

Constant Summary

Constants inherited from Corrector

Corrector::NOOP_CONSUMER

Instance Method Summary collapse

Methods inherited from Corrector

#remove_leading, #remove_preceding, #remove_trailing, source_buffer

Constructor Details

#initialize(source, corr = []) ⇒ Corrector

Support legacy second argument


10
11
12
13
14
15
16
17
18
# File 'lib/rubocop/cop/legacy/corrector.rb', line 10

def initialize(source, corr = [])
  super(source)
  if corr.is_a?(CorrectionsProxy)
    merge!(corr.send(:corrector))
  else
    # warn "Corrector.new with corrections is deprecated." unless corr.empty? TODO
    corr.each { |c| corrections << c }
  end
end

Instance Method Details

#correctionsObject


20
21
22
23
# File 'lib/rubocop/cop/legacy/corrector.rb', line 20

def corrections
  # warn "#corrections is deprecated. Open an issue if you have a valid usecase." TODO
  CorrectionsProxy.new(self)
end