Class: Spoom::Coverage::Page

Inherits:
Template show all
Extended by:
T::Helpers, T::Sig
Defined in:
lib/spoom/coverage/report.rb

Direct Known Subclasses

Report

Constant Summary collapse

TEMPLATE =
T.let("#{Spoom::SPOOM_PATH}/templates/page.erb", String)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Template

#erb, #get_binding, #html

Constructor Details

#initialize(title:, palette:, template: TEMPLATE) ⇒ Page

Returns a new instance of Page.



53
54
55
56
57
# File 'lib/spoom/coverage/report.rb', line 53

def initialize(title:, palette:, template: TEMPLATE)
  super(template: template)
  @title = title
  @palette = palette
end

Instance Attribute Details

#paletteObject (readonly)

Returns the value of attribute palette.



50
51
52
# File 'lib/spoom/coverage/report.rb', line 50

def palette
  @palette
end

#titleObject (readonly)

Returns the value of attribute title.



47
48
49
# File 'lib/spoom/coverage/report.rb', line 47

def title
  @title
end

Instance Method Details

#body_htmlObject



75
76
77
# File 'lib/spoom/coverage/report.rb', line 75

def body_html
  cards.map(&:html).join("\n")
end

#cardsObject



80
# File 'lib/spoom/coverage/report.rb', line 80

def cards; end


83
84
85
# File 'lib/spoom/coverage/report.rb', line 83

def footer_html
  "Generated by <a href='https://github.com/Shopify/spoom'>spoom</a> on #{Time.now.utc}."
end

#header_htmlObject



70
71
72
# File 'lib/spoom/coverage/report.rb', line 70

def header_html
  "<h1 class='display-3'>#{title}</h1>"
end

#header_scriptObject



65
66
67
# File 'lib/spoom/coverage/report.rb', line 65

def header_script
  D3.header_script(palette)
end

#header_styleObject



60
61
62
# File 'lib/spoom/coverage/report.rb', line 60

def header_style
  D3.header_style
end