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.



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

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.



241
242
243
# File 'lib/spoom/coverage/report.rb', line 241

def project_name
  @project_name
end

#sigils_treeObject (readonly)

Returns the value of attribute sigils_tree.



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

def sigils_tree
  @sigils_tree
end

#snapshotsObject (readonly)

Returns the value of attribute snapshots.



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

def snapshots
  @snapshots
end

#sorbet_intro_commitObject (readonly)

Returns the value of attribute sorbet_intro_commit.



244
245
246
# File 'lib/spoom/coverage/report.rb', line 244

def sorbet_intro_commit
  @sorbet_intro_commit
end

#sorbet_intro_dateObject (readonly)

Returns the value of attribute sorbet_intro_date.



247
248
249
# File 'lib/spoom/coverage/report.rb', line 247

def sorbet_intro_date
  @sorbet_intro_date
end

Instance Method Details

#cardsObject



293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/spoom/coverage/report.rb', line 293

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::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



282
283
284
285
286
287
288
289
290
# File 'lib/spoom/coverage/report.rb', line 282

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