Class: RuboCop::Cop::Legacy::CorrectionsProxy

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

Overview

Legacy support for Corrector#corrections See docs.rubocop.org/rubocop/v1_upgrade_notes.html

Instance Method Summary collapse

Constructor Details

#initialize(corrector) ⇒ CorrectionsProxy

Returns a new instance of CorrectionsProxy.

 9 10 11
# File 'lib/rubocop/cop/legacy/corrections_proxy.rb', line 9 def initialize(corrector) @corrector = corrector end

Instance Method Details

#<<(callable) ⇒ Object

 13 14 15
# File 'lib/rubocop/cop/legacy/corrections_proxy.rb', line 13 def <<(callable) suppress_clobbering { @corrector.transaction { callable.call(@corrector) } } end

#concat(corrections) ⇒ Object

 21 22 23 24 25 26 27
# File 'lib/rubocop/cop/legacy/corrections_proxy.rb', line 21 def concat(corrections) if corrections.is_a?(CorrectionsProxy) suppress_clobbering { corrector.merge!(corrections.corrector) } else corrections.each { |correction| self << correction } end end

#empty?Boolean

Returns:

  • (Boolean)
 17 18 19
# File 'lib/rubocop/cop/legacy/corrections_proxy.rb', line 17 def empty? @corrector.empty? end