Class: RuboCop::Cop::Legacy::CorrectionsProxy
- Inherits:
-
Object
- Object
- RuboCop::Cop::Legacy::CorrectionsProxy
- 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
- #<<(callable) ⇒ Object
- #concat(corrections) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize(corrector) ⇒ CorrectionsProxy
constructor
A new instance of CorrectionsProxy.
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
17 18 19 |
# File 'lib/rubocop/cop/legacy/corrections_proxy.rb', line 17 def empty? @corrector.empty? end |