Class: Ucode::CodeChart::BatchRunner
- Inherits:
-
Object
- Object
- Ucode::CodeChart::BatchRunner
- Defined in:
- lib/ucode/code_chart/batch_runner.rb
Overview
Multi-block orchestration: drives one Writer per gap block, enforces per-block idempotency, isolates per-block failures.
Composes four orthogonal concerns:
* {Fetcher} — owns PDF download + cache + integrity check
* {Writer} — owns one block's extraction + disk write
* {GapAnalyzer} — owns "which codepoints to extract per block"
* {SkipChecker} — owns "should this block be skipped" (this file)
Each concern is replaceable; BatchRunner itself is a pure iterator + aggregator. Adding a new "skip if X" rule = one method on SkipChecker, one entry in the predicate chain.
Defined Under Namespace
Classes: Aggregate, BlockSummary, SkipChecker
Instance Method Summary collapse
-
#initialize(output_root:, ucd_version:, fetcher:, writer_class: Writer, skip_checker_class: SkipChecker) ⇒ BatchRunner
constructor
A new instance of BatchRunner.
- #run(gap_analyzer:, blocks:) {|summary| ... } ⇒ Aggregate
Constructor Details
#initialize(output_root:, ucd_version:, fetcher:, writer_class: Writer, skip_checker_class: SkipChecker) ⇒ BatchRunner
Returns a new instance of BatchRunner.
51 52 53 54 55 56 57 58 |
# File 'lib/ucode/code_chart/batch_runner.rb', line 51 def initialize(output_root:, ucd_version:, fetcher:, writer_class: Writer, skip_checker_class: SkipChecker) @output_root = Pathname.new(output_root) @ucd_version = ucd_version @fetcher = fetcher @writer_class = writer_class @skip_checker_class = skip_checker_class end |
Instance Method Details
#run(gap_analyzer:, blocks:) {|summary| ... } ⇒ Aggregate
64 65 66 67 68 69 70 71 72 |
# File 'lib/ucode/code_chart/batch_runner.rb', line 64 def run(gap_analyzer:, blocks:) summaries = [] gap_analyzer.each_block_gap do |gap| summary = process_gap(gap, blocks.fetch(gap.block_id)) summaries << summary yield summary if block_given? end build_aggregate(summaries) end |