Class: Templatecop::TemplateCorrector

Inherits:
Object
  • Object
show all
Defined in:
lib/templatecop/template_corrector.rb

Overview

Apply auto-corrections to Template file.

Instance Method Summary collapse

Constructor Details

#initialize(file_path:, offenses:, source:) ⇒ TemplateCorrector

Returns a new instance of TemplateCorrector.

Parameters:



12
13
14
15
16
# File 'lib/templatecop/template_corrector.rb', line 12

def initialize(file_path:, offenses:, source:)
  @file_path = file_path
  @offenses = offenses
  @source = source
end

Instance Method Details

#callString

Returns Rewritten Template code.

Returns:

  • (String)

    Rewritten Template code.



19
20
21
# File 'lib/templatecop/template_corrector.rb', line 19

def call
  ::RuboCop::Cop::Legacy::Corrector.new(source_buffer, corrections).rewrite
end