Class: RuboCop::Cop::Legacy::Corrector
- Inherits:
-
Corrector
- Object
- Parser::Source::TreeRewriter
- Corrector
- RuboCop::Cop::Legacy::Corrector
- Defined in:
- lib/rubocop/cop/legacy/corrector.rb
Overview
Legacy Corrector for v0 API support. See docs.rubocop.org/rubocop/v1_upgrade_notes.html
Constant Summary
Constants inherited from Corrector
Instance Method Summary collapse
- #corrections ⇒ Object
-
#initialize(source, corr = []) ⇒ Corrector
constructor
Support legacy second argument.
Methods inherited from Corrector
#remove_leading, #remove_preceding, #remove_trailing, source_buffer, #swap
Constructor Details
#initialize(source, corr = []) ⇒ Corrector
Support legacy second argument
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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 unless corr.empty? warn Rainbow(<<~WARNING).yellow, uplevel: 1 `Corrector.new` with corrections is deprecated. See https://docs.rubocop.org/rubocop/v1_upgrade_notes.html WARNING end corr.each { |c| corrections << c } end end |
Instance Method Details
#corrections ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/rubocop/cop/legacy/corrector.rb', line 26 def corrections warn Rainbow(<<~WARNING).yellow, uplevel: 1 `Corrector#corrections` is deprecated. Open an issue if you have a valid usecase. See https://docs.rubocop.org/rubocop/v1_upgrade_notes.html WARNING CorrectionsProxy.new(self) end |