Class: SkillBench::OutputFormatter
- Inherits:
-
Object
- Object
- SkillBench::OutputFormatter
- Defined in:
- lib/skill_bench/output_formatter.rb
Overview
Handles formatting output for different use cases (human, CI, etc.). Delegates all presentation logic to focused service objects under Services.
Class Method Summary collapse
-
.exit_code(result) ⇒ Integer
Determine exit code based on eval result.
-
.format(result, format: :human) ⇒ String
Format the eval result for output.
Class Method Details
.exit_code(result) ⇒ Integer
Determine exit code based on eval result.
34 35 36 37 38 39 40 |
# File 'lib/skill_bench/output_formatter.rb', line 34 def self.exit_code(result) return 0 if result[:pass] return 1 unless result[:success] report = result.dig(:response, :report) report&.verdict ? 0 : 1 end |
.format(result, format: :human) ⇒ String
Format the eval result for output.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/skill_bench/output_formatter.rb', line 19 def self.format(result, format: :human) case format when :json Services::JsonFormatter.format(result) when :junit Services::JUnitFormatter.format(result) else format_human(result) end end |