Method: RuboCop::Formatter::HTMLFormatter#render_html

Defined in:
lib/rubocop/formatter/html_formatter.rb

#render_htmlObject



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/rubocop/formatter/html_formatter.rb', line 50

def render_html
  context = ERBContext.new(files, summary)

  template = File.read(TEMPLATE_PATH, encoding: Encoding::UTF_8)
  erb = ERB.new(template)
  html = erb.result(context.binding).lines.map do |line|
    line.match?(/\A\s*\z/) ? "\n" : line
  end.join

  output.write html
end