Class: Pinspec::Report::Summary

Inherits:
Object
  • Object
show all
Defined in:
lib/pinspec/report/summary.rb

Constant Summary collapse

OUTPUT =
"tmp/pinspec/report.md"

Instance Method Summary collapse

Constructor Details

#initialize(app_root:, profile:, target: nil, plan: nil, corpus: nil, stability: nil, written: nil, outcomes: nil, scores: nil) ⇒ Summary

Returns a new instance of Summary.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/pinspec/report/summary.rb', line 10

def initialize(app_root:, profile:, target: nil, plan: nil, corpus: nil, stability: nil,
               written: nil, outcomes: nil, scores: nil)
  @app_root = app_root
  @profile = profile
  @target = target
  @plan = plan
  @corpus = corpus
  @stability = stability
  @written = written
  @outcomes = outcomes
  @scores = scores
end

Instance Method Details

#pathObject



23
24
25
# File 'lib/pinspec/report/summary.rb', line 23

def path
  File.join(@app_root, OUTPUT)
end

#renderObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/pinspec/report/summary.rb', line 33

def render
  sections = [
    heading,
    verdict,
    what_was_pinned,
    what_was_refused,
    isolation_note,
    coverage_caveats,
    redactions,
    provenance,
    hazards,
    mutation_scores,
    footer
  ]

  sections.compact.join("\n")
end

#write!Object



27
28
29
30
31
# File 'lib/pinspec/report/summary.rb', line 27

def write!
  FileUtils.mkdir_p(File.dirname(path))
  File.write(path, render)
  path
end