Class: Ea::Diff::HtmlReporter

Inherits:
Object
  • Object
show all
Defined in:
lib/ea/diff/html_reporter.rb

Overview

Renders a Comparator's differences as an HTML report with color-coded rows. Useful for CI artifacts and PR review.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(comparator) ⇒ HtmlReporter

Returns a new instance of HtmlReporter.



10
11
12
# File 'lib/ea/diff/html_reporter.rb', line 10

def initialize(comparator)
  @comparator = comparator
end

Instance Attribute Details

#comparatorObject (readonly)

Returns the value of attribute comparator.



8
9
10
# File 'lib/ea/diff/html_reporter.rb', line 8

def comparator
  @comparator
end

Instance Method Details

#renderString

Returns standalone HTML document.

Returns:

  • (String)

    standalone HTML document



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ea/diff/html_reporter.rb', line 15

def render
  <<~HTML
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>EA Diff Report</title>
      <style>#{css}</style>
    </head>
    <body>
      <h1>EA Diff Report</h1>
      #{summary_section}
      #{table_section}
    </body>
    </html>
  HTML
end