Class: SkillBench::Services::OutputPersistenceService Deprecated
- Inherits:
-
Object
- Object
- SkillBench::Services::OutputPersistenceService
- Defined in:
- lib/skill_bench/services/output_persistence_service.rb
Overview
Deprecated.
Use Cli::RunCommand output handling instead.
Service object for persisting evaluation results to JSON files. Handles file I/O, JSON serialization, and provides standardized error responses for filesystem operations.
Constant Summary collapse
- WRITE_ERROR =
'Failed to write output file'
Class Method Summary collapse
-
.call(result, output_path:) ⇒ Hash
Persists evaluation results to a JSON file with proper formatting.
Instance Method Summary collapse
-
#call ⇒ Hash
Persists the evaluation result to the specified output path.
-
#initialize(result, output_path:) ⇒ OutputPersistenceService
constructor
Initializes a new persistence service instance.
Constructor Details
#initialize(result, output_path:) ⇒ OutputPersistenceService
Initializes a new persistence service instance.
37 38 39 40 |
# File 'lib/skill_bench/services/output_persistence_service.rb', line 37 def initialize(result, output_path:) @result = result @output_path = output_path end |
Class Method Details
.call(result, output_path:) ⇒ Hash
Persists evaluation results to a JSON file with proper formatting.
29 30 31 |
# File 'lib/skill_bench/services/output_persistence_service.rb', line 29 def self.call(result, output_path:) new(result, output_path: output_path).call end |
Instance Method Details
#call ⇒ Hash
Persists the evaluation result to the specified output path.
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/skill_bench/services/output_persistence_service.rb', line 49 def call return { success: true, response: {} } if @output_path.to_s.empty? ensure_directory_exists write_json_file { success: true, response: { message: "Report saved to #{@output_path}" } } rescue SystemCallError, JSON::GeneratorError => e { success: false, response: { error: { message: "#{WRITE_ERROR}: #{e.}" } } } end |