Class: YardJunk::Janitor::HtmlReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- YardJunk::Janitor::HtmlReporter
- Defined in:
- lib/yard-junk/janitor/html_reporter.rb
Overview
Reporter that just outputs everything in HTML format. Useful for usage with Jenkins. See BaseReporter for details about reporters.
Constant Summary collapse
- HEADER =
<<-HTML <!DOCTYPE html> <html lang="en"> <header> <meta charset='UTF-8' /> <title>YARD-Junk Report</title> <style> body, html { } body { font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; margin: 0; padding: 20px; } h2 { font-size: 1.6rem; } h2 small { color: gray; font-weight: normal; } span.path { font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 85%; } .problem { color: red; } .notice { color: gray; } p.stats { padding: 10px; font-size: 1.2em; border: 1px dotted silver; } </style> </header> <body> <h1>YARD Validation Report</h1> HTML
- FOOTER =
<<-HTML </body> </html> HTML
- SECTION =
<<-HTML <h2 class="<%= title == 'Notices' ? 'notice' : 'problem' %>"> <%= title %> <small>(<%= explanation %>)</small> </h2> HTML
- ROW =
<<-HTML <li><span class="path"><%= file %>:<%= line %></span>: <%= message %></li> HTML
- STATS =
<<-HTML <p class="stats"> <span class="<%= 'problem' unless errors.zero? %>"><%= errors %> failures</span>, <span class="<%= 'problem' unless problems.zero? %>"><%= problems %> problems</span> (ready in <%= duration %>) </p> HTML
- Helper =
Class.new(OpenStruct) do def the_binding binding end end
Instance Attribute Summary collapse
-
#html ⇒ Object
readonly
Returns the value of attribute html.
Instance Method Summary collapse
- #finalize ⇒ Object
-
#initialize ⇒ HtmlReporter
constructor
A new instance of HtmlReporter.
Methods inherited from BaseReporter
Constructor Details
#initialize ⇒ HtmlReporter
Returns a new instance of HtmlReporter.
82 83 84 85 |
# File 'lib/yard-junk/janitor/html_reporter.rb', line 82 def initialize(*) super @html = HEADER.dup end |
Instance Attribute Details
#html ⇒ Object (readonly)
Returns the value of attribute html.
80 81 82 |
# File 'lib/yard-junk/janitor/html_reporter.rb', line 80 def html @html end |
Instance Method Details
#finalize ⇒ Object
87 88 89 90 |
# File 'lib/yard-junk/janitor/html_reporter.rb', line 87 def finalize @html << FOOTER @io.puts(@html) end |