Class: Insika::Soak::Report::Result
- Inherits:
-
Data
- Object
- Data
- Insika::Soak::Report::Result
- Defined in:
- lib/insika/soak/report.rb
Overview
The verdict plus its evidence. reasons name every breach; for a
fail the report-only metrics point the leak hunt. :invalid carries
NO metrics at all — a tampered file must not produce rates.
Instance Attribute Summary collapse
-
#envelope_sha ⇒ Object
readonly
Returns the value of attribute envelope_sha.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#reasons ⇒ Object
readonly
Returns the value of attribute reasons.
-
#run_id ⇒ Object
readonly
Returns the value of attribute run_id.
-
#verdict ⇒ Object
readonly
Returns the value of attribute verdict.
Instance Method Summary collapse
- #pass? ⇒ Boolean
- #to_h ⇒ Object
-
#to_s(color: false) ⇒ Object
Human report (Doctor::Report idiom).
Instance Attribute Details
#envelope_sha ⇒ Object (readonly)
Returns the value of attribute envelope_sha
18 19 20 |
# File 'lib/insika/soak/report.rb', line 18 def envelope_sha @envelope_sha end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics
18 19 20 |
# File 'lib/insika/soak/report.rb', line 18 def metrics @metrics end |
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons
18 19 20 |
# File 'lib/insika/soak/report.rb', line 18 def reasons @reasons end |
#run_id ⇒ Object (readonly)
Returns the value of attribute run_id
18 19 20 |
# File 'lib/insika/soak/report.rb', line 18 def run_id @run_id end |
#verdict ⇒ Object (readonly)
Returns the value of attribute verdict
18 19 20 |
# File 'lib/insika/soak/report.rb', line 18 def verdict @verdict end |
Instance Method Details
#pass? ⇒ Boolean
19 |
# File 'lib/insika/soak/report.rb', line 19 def pass? = verdict == :pass |
#to_h ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/insika/soak/report.rb', line 21 def to_h { "verdict" => verdict.to_s, "reasons" => reasons, "metrics" => metrics.each_with_object({}) { |(k, v), acc| acc[k.to_s] = v }, "envelope_sha" => envelope_sha, "run_id" => run_id } end |
#to_s(color: false) ⇒ Object
Human report (Doctor::Report idiom).
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/insika/soak/report.rb', line 30 def to_s(color: false) head = "SOAK #{run_id} — #{verdict.to_s.upcase}" head += " [#{envelope_sha}]" unless envelope_sha.nil? lines = [head] unless reasons.empty? lines << " breaches:" reasons.each { |r| lines << " - #{r}" } end lines.concat(metric_lines) if verdict != :invalid lines << leak_hunt if verdict == :fail && leak_hunt lines.join("\n") end |