Class: SkillBench::Services::SummaryFormatter
- Inherits:
-
Object
- Object
- SkillBench::Services::SummaryFormatter
- Defined in:
- lib/skill_bench/services/summary_formatter.rb
Overview
Builds a compact JSON summary of a batch run for CI gating.
Surfaces the aggregate pass/fail counts plus rolled-up token and cost usage and the single worst skill-vs-baseline delta across the batch, so a CI job can gate on (and archive) one machine-readable artifact.
Class Method Summary collapse
-
.format(aggregate) ⇒ String
Format an aggregate batch envelope as a pretty JSON summary string.
Instance Method Summary collapse
-
#format ⇒ String
Builds the JSON summary document.
-
#initialize(aggregate) ⇒ SummaryFormatter
constructor
A new instance of SummaryFormatter.
Constructor Details
#initialize(aggregate) ⇒ SummaryFormatter
Returns a new instance of SummaryFormatter.
22 23 24 25 |
# File 'lib/skill_bench/services/summary_formatter.rb', line 22 def initialize(aggregate) @results = aggregate[:results] || [] @summary = aggregate[:summary] || {} end |
Class Method Details
.format(aggregate) ⇒ String
Format an aggregate batch envelope as a pretty JSON summary string.
17 18 19 |
# File 'lib/skill_bench/services/summary_formatter.rb', line 17 def self.format(aggregate) new(aggregate).format end |
Instance Method Details
#format ⇒ String
Builds the JSON summary document.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/skill_bench/services/summary_formatter.rb', line 30 def format JSON.pretty_generate( passed: summary[:passed], failed: summary[:failed], total: summary[:total], tokens: total_tokens, cost: total_cost, worst_delta: worst_delta ) end |