Class: Similatron::HtmlReport
- Inherits:
-
Object
- Object
- Similatron::HtmlReport
- Defined in:
- lib/similatron/html_report.rb
Instance Attribute Summary collapse
-
#run ⇒ Object
readonly
Returns the value of attribute run.
Instance Method Summary collapse
- #css_styles ⇒ Object
- #failures? ⇒ Boolean
- #full_path(path) ⇒ Object
-
#initialize(run) ⇒ HtmlReport
constructor
A new instance of HtmlReport.
- #ok? ⇒ Boolean
- #overwrites? ⇒ Boolean
- #render ⇒ Object
- #run_at ⇒ Object
Constructor Details
#initialize(run) ⇒ HtmlReport
Returns a new instance of HtmlReport.
6 7 8 9 |
# File 'lib/similatron/html_report.rb', line 6 def initialize(run) @run = run @time = Time.now end |
Instance Attribute Details
#run ⇒ Object (readonly)
Returns the value of attribute run.
4 5 6 |
# File 'lib/similatron/html_report.rb', line 4 def run @run end |
Instance Method Details
#css_styles ⇒ Object
17 18 19 20 21 22 |
# File 'lib/similatron/html_report.rb', line 17 def css_styles ["normalize.css", "skeleton.css"].map do |file| css_path = File.join(Similatron.lib_path, "assets/Skeleton-2.0.4/css", file) File.read(css_path) end end |
#failures? ⇒ Boolean
36 37 38 |
# File 'lib/similatron/html_report.rb', line 36 def failures? !run.failed_comparisons.empty? end |
#full_path(path) ⇒ Object
24 25 26 |
# File 'lib/similatron/html_report.rb', line 24 def full_path(path) File.(path) end |
#ok? ⇒ Boolean
40 41 42 |
# File 'lib/similatron/html_report.rb', line 40 def ok? !overwrites? && !failures? end |
#overwrites? ⇒ Boolean
32 33 34 |
# File 'lib/similatron/html_report.rb', line 32 def overwrites? !run.overwrite_comparisons.empty? end |
#render ⇒ Object
11 12 13 14 15 |
# File 'lib/similatron/html_report.rb', line 11 def render template_path = File.join(Similatron.lib_path, "assets/report.html.erb") template = ERB.new(File.read(template_path)) template.result(binding) end |
#run_at ⇒ Object
28 29 30 |
# File 'lib/similatron/html_report.rb', line 28 def run_at @time.strftime("%b %d, %Y %H:%M") end |