Class: PetriDish::ResultsBuilder
- Inherits:
-
Object
- Object
- PetriDish::ResultsBuilder
- Defined in:
- lib/petri_dish/results_builder.rb
Constant Summary collapse
- RESULT_PATTERN =
/^\S*\s*RESULT:\s*(\S+)\s*\|\s*(.*?)\s*$/
Instance Method Summary collapse
- #build! ⇒ Object
-
#initialize(hook_log_path, transcript_path, results_dir) ⇒ ResultsBuilder
constructor
A new instance of ResultsBuilder.
Constructor Details
#initialize(hook_log_path, transcript_path, results_dir) ⇒ ResultsBuilder
Returns a new instance of ResultsBuilder.
11 12 13 14 15 |
# File 'lib/petri_dish/results_builder.rb', line 11 def initialize(hook_log_path, transcript_path, results_dir) @hook_log_path = hook_log_path @transcript_path = transcript_path @results_dir = results_dir end |
Instance Method Details
#build! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/petri_dish/results_builder.rb', line 17 def build! tool_events = load_tool_events transcript_results = extract_transcript_results merged = merge(tool_events, transcript_results) return if merged.empty? FileUtils.mkdir_p(@results_dir) md_path = File.join(@results_dir, "results.md") jsonl_path = File.join(@results_dir, "results.jsonl") File.write(md_path, format_markdown(merged)) File.write(jsonl_path, format_jsonl(merged)) log "Results written to #{@results_dir} (#{merged.size} entries)" end |