Class: Spoom::Coverage::Page Abstract
- Defined in:
- lib/spoom/coverage/report.rb
Overview
This class is abstract.
Direct Known Subclasses
Constant Summary collapse
- TEMPLATE =
: String
"#{Spoom::SPOOM_PATH}/templates/page.erb"
Instance Attribute Summary collapse
-
#palette ⇒ Object
readonly
: D3::ColorPalette.
-
#title ⇒ Object
readonly
: String.
Instance Method Summary collapse
-
#body_html ⇒ Object
: -> String.
-
#cards ⇒ Object
abstract
: -> Array.
-
#footer_html ⇒ Object
: -> String.
-
#header_html ⇒ Object
: -> String.
-
#header_script ⇒ Object
: -> String.
-
#header_style ⇒ Object
: -> String.
-
#initialize(title:, palette:, template: TEMPLATE) ⇒ Page
constructor
: (title: String, palette: D3::ColorPalette, ?template: String) -> void.
Methods inherited from Template
Constructor Details
#initialize(title:, palette:, template: TEMPLATE) ⇒ Page
: (title: String, palette: D3::ColorPalette, ?template: String) -> void
45 46 47 48 49 |
# File 'lib/spoom/coverage/report.rb', line 45 def initialize(title:, palette:, template: TEMPLATE) super(template: template) @title = title @palette = palette end |
Instance Attribute Details
#palette ⇒ Object (readonly)
: D3::ColorPalette
42 43 44 |
# File 'lib/spoom/coverage/report.rb', line 42 def palette @palette end |
#title ⇒ Object (readonly)
: String
39 40 41 |
# File 'lib/spoom/coverage/report.rb', line 39 def title @title end |
Instance Method Details
#body_html ⇒ Object
: -> String
67 68 69 |
# File 'lib/spoom/coverage/report.rb', line 67 def body_html cards.map(&:html).join("\n") end |
#cards ⇒ Object
This method is abstract.
: -> Array
73 |
# File 'lib/spoom/coverage/report.rb', line 73 def cards = raise NotImplementedError, "Abstract method called" |
#footer_html ⇒ Object
: -> String
76 77 78 |
# File 'lib/spoom/coverage/report.rb', line 76 def "Generated by <a href='https://github.com/Shopify/spoom'>spoom</a> on #{Time.now.utc}." end |
#header_html ⇒ Object
: -> String
62 63 64 |
# File 'lib/spoom/coverage/report.rb', line 62 def header_html "<h1 class='display-3'>#{title}</h1>" end |
#header_script ⇒ Object
: -> String
57 58 59 |
# File 'lib/spoom/coverage/report.rb', line 57 def header_script D3.header_script(palette) end |
#header_style ⇒ Object
: -> String
52 53 54 |
# File 'lib/spoom/coverage/report.rb', line 52 def header_style D3.header_style end |