Class: Spoom::Coverage::Report

Inherits:
Page show all
Defined in:
lib/spoom/coverage/report.rb

Constant Summary

Constants inherited from Page

Page::TEMPLATE

Instance Attribute Summary

Attributes inherited from Page

#palette, #title

Instance Method Summary collapse

Methods inherited from Page

#body_html, #footer_html, #header_script, #header_style

Methods inherited from Template

#erb, #get_binding, #html

Constructor Details

#initialize(project_name:, palette:, snapshots:, file_tree:, nodes_strictnesses:, nodes_strictness_scores:, sorbet_intro_commit: nil, sorbet_intro_date: nil) ⇒ Report

: (project_name: String, palette: D3::ColorPalette, snapshots: Array, file_tree: FileTree, nodes_strictnesses: Hash[FileTree::Node, String?], nodes_strictness_scores: Hash[FileTree::Node, Float], ?sorbet_intro_commit: String?, ?sorbet_intro_date: Time?) -> void



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/spoom/coverage/report.rb', line 226

def initialize(
  project_name:,
  palette:,
  snapshots:,
  file_tree:,
  nodes_strictnesses:,
  nodes_strictness_scores:,
  sorbet_intro_commit: nil,
  sorbet_intro_date: nil
)
  super(title: project_name, palette: palette)
  @project_name = project_name
  @snapshots = snapshots
  @file_tree = file_tree
  @nodes_strictnesses = nodes_strictnesses
  @nodes_strictness_scores = nodes_strictness_scores
  @sorbet_intro_commit = sorbet_intro_commit
  @sorbet_intro_date = sorbet_intro_date
end

Instance Method Details

#cardsObject

: -> Array



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/spoom/coverage/report.rb', line 260

def cards
  last = T.must(@snapshots.last)
  cards = []
  cards << Cards::Snapshot.new(snapshot: last)
  cards << Cards::Map.new(
    file_tree: @file_tree,
    nodes_strictnesses: @nodes_strictnesses,
    nodes_strictness_scores: @nodes_strictness_scores,
  )
  cards << Cards::Timeline::Sigils.new(snapshots: @snapshots)
  cards << Cards::Timeline::Calls.new(snapshots: @snapshots)
  cards << Cards::Timeline::Sigs.new(snapshots: @snapshots)
  cards << Cards::Timeline::RBIs.new(snapshots: @snapshots)
  cards << Cards::Timeline::Versions.new(snapshots: @snapshots)
  cards << Cards::Timeline::Runtimes.new(snapshots: @snapshots)
  cards << Cards::SorbetIntro.new(
    sorbet_intro_commit: @sorbet_intro_commit,
    sorbet_intro_date: @sorbet_intro_date,
  )
  cards
end

#header_htmlObject

: -> String



248
249
250
251
252
253
254
255
256
# File 'lib/spoom/coverage/report.rb', line 248

def header_html
  last = T.must(@snapshots.last)
  <<~ERB
    <h1 class="display-3">
      #{@project_name}
      <span class="badge badge-pill badge-dark" style="font-size: 20%;">#{last.commit_sha}</span>
    </h1>
  ERB
end