Class: ERBLint::Corrector
- Inherits:
-
Object
- Object
- ERBLint::Corrector
- Defined in:
- lib/erb_lint/corrector.rb
Constant Summary collapse
- BASE =
::RuboCop::Cop::Corrector
Instance Attribute Summary collapse
-
#corrected_content ⇒ Object
readonly
Returns the value of attribute corrected_content.
-
#offenses ⇒ Object
readonly
Returns the value of attribute offenses.
-
#processed_source ⇒ Object
readonly
Returns the value of attribute processed_source.
Instance Method Summary collapse
- #corrections ⇒ Object
- #corrector ⇒ Object
- #diagnostics ⇒ Object
-
#initialize(processed_source, offenses) ⇒ Corrector
constructor
A new instance of Corrector.
Constructor Details
#initialize(processed_source, offenses) ⇒ Corrector
Returns a new instance of Corrector.
7 8 9 10 11 |
# File 'lib/erb_lint/corrector.rb', line 7 def initialize(processed_source, offenses) @processed_source = processed_source @offenses = offenses @corrected_content = corrector.rewrite end |
Instance Attribute Details
#corrected_content ⇒ Object (readonly)
Returns the value of attribute corrected_content.
5 6 7 |
# File 'lib/erb_lint/corrector.rb', line 5 def corrected_content @corrected_content end |
#offenses ⇒ Object (readonly)
Returns the value of attribute offenses.
5 6 7 |
# File 'lib/erb_lint/corrector.rb', line 5 def offenses @offenses end |
#processed_source ⇒ Object (readonly)
Returns the value of attribute processed_source.
5 6 7 |
# File 'lib/erb_lint/corrector.rb', line 5 def processed_source @processed_source end |
Instance Method Details
#corrections ⇒ Object
13 14 15 16 17 |
# File 'lib/erb_lint/corrector.rb', line 13 def corrections @corrections ||= @offenses.map do |offense| offense.linter.autocorrect(@processed_source, offense) if offense.linter.class.support_autocorrect? end.compact end |
#corrector ⇒ Object
19 20 21 |
# File 'lib/erb_lint/corrector.rb', line 19 def corrector BASE.new(@processed_source.source_buffer, corrections) end |
#diagnostics ⇒ Object
27 28 29 |
# File 'lib/erb_lint/corrector.rb', line 27 def diagnostics [] end |