Class: Spoom::Coverage::Report

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

Constant Summary

Constants inherited from Page

Page::TEMPLATE

Instance Attribute Summary collapse

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:, sigils_tree:, sorbet_intro_commit: nil, sorbet_intro_date: nil) ⇒ Report

Returns a new instance of Report.



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/spoom/coverage/report.rb', line 274

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

Instance Attribute Details

#project_nameObject (readonly)

Returns the value of attribute project_name.



250
251
252
# File 'lib/spoom/coverage/report.rb', line 250

def project_name
  @project_name
end

#sigils_treeObject (readonly)

Returns the value of attribute sigils_tree.



262
263
264
# File 'lib/spoom/coverage/report.rb', line 262

def sigils_tree
  @sigils_tree
end

#snapshotsObject (readonly)

Returns the value of attribute snapshots.



259
260
261
# File 'lib/spoom/coverage/report.rb', line 259

def snapshots
  @snapshots
end

#sorbet_intro_commitObject (readonly)

Returns the value of attribute sorbet_intro_commit.



253
254
255
# File 'lib/spoom/coverage/report.rb', line 253

def sorbet_intro_commit
  @sorbet_intro_commit
end

#sorbet_intro_dateObject (readonly)

Returns the value of attribute sorbet_intro_date.



256
257
258
# File 'lib/spoom/coverage/report.rb', line 256

def sorbet_intro_date
  @sorbet_intro_date
end

Instance Method Details

#cardsObject



302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/spoom/coverage/report.rb', line 302

def cards
  last = T.must(snapshots.last)
  cards = []
  cards << Cards::Snapshot.new(snapshot: last)
  cards << Cards::Map.new(sigils_tree: sigils_tree)
  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



291
292
293
294
295
296
297
298
299
# File 'lib/spoom/coverage/report.rb', line 291

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