Class: B::HtmlWriter
- Inherits:
-
Object
- Object
- B::HtmlWriter
- Defined in:
- lib/b/output_plugins.rb
Overview
print results as a HTML table
Constant Summary collapse
- COLUMNS =
[:group, :id, :rounds, :rate, :mean, :max, :min, :stddev, :x]
Instance Method Summary collapse
- #finish(job) ⇒ Object
-
#initialize(out = $stdout) ⇒ HtmlWriter
constructor
A new instance of HtmlWriter.
- #register(job) ⇒ Object
Constructor Details
#initialize(out = $stdout) ⇒ HtmlWriter
Returns a new instance of HtmlWriter.
28 29 30 31 32 33 |
# File 'lib/b/output_plugins.rb', line 28 def initialize(out=$stdout) @out = out printf "<table>\n<tr>" COLUMNS.map { |c| printf "<th>#{c}</th>" } printf "</tr>\n" end |
Instance Method Details
#finish(job) ⇒ Object
35 36 37 38 39 40 41 42 |
# File 'lib/b/output_plugins.rb', line 35 def finish(job) @done = (@done||0) +1 printf "<tr>" COLUMNS.map { |c| printf "<td>#{job.send(c)}</td>" } printf "</tr>\n" printf "</table>\n" if @done == @todo end |
#register(job) ⇒ Object
24 25 26 |
# File 'lib/b/output_plugins.rb', line 24 def register(job) @todo = (@todo||0) +1 end |