class RDocRuboCop::Lang::C::Corrector

Attributes

corrected_source[R]

Public Class Methods

new(source_file) click to toggle source
# File lib/rdoc_rubocop/lang/c/corrector.rb, line 7
def initialize(source_file)
  @source_file = source_file
  @corrected_source = nil
end

Public Instance Methods

correct() click to toggle source
# File lib/rdoc_rubocop/lang/c/corrector.rb, line 12
def correct
  @corrected_source = @source_file.source.dup

  @source_file.comments.reverse_each do |comment|
    next if comment.source_codes.empty?

    index = comment.offset_begin
    length = comment.length
    @corrected_source[index, length] = comment.corrected_text
  end
end