Method: RuboCop::Cop::Corrector#rewrite

Defined in:
lib/rubocop/cop/corrector.rb

#rewriteString

Does the actual rewrite and returns string corresponding to the rewritten source.

Returns:

  • (String)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/rubocop/cop/corrector.rb', line 52

def rewrite
  # rubocop:disable Lint/HandleExceptions
  @corrections.each do |correction|
    begin
      @source_rewriter.transaction do
        correction.call(self)
      end
    rescue ::Parser::ClobberingError
    end
  end
  # rubocop:enable Lint/HandleExceptions

  @source_rewriter.process
end