Class: Ucode::CodeChart::BatchRunner::SkipChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/ucode/code_chart/batch_runner.rb

Overview

Per-block idempotency check. A block is skippable iff:

1. Its output dir exists.
2. Every codepoint in the {BlockGap} has an `.svg` AND a `.json`.
3. Each sidecar's `source_pdf_sha256` matches the current PDF's sha256.
4. Each sidecar's `ucd_version` matches the current UCD version.

Adding a new predicate = one method + one entry in #skip?. No change to Ucode::CodeChart::BatchRunner.

Instance Method Summary collapse

Constructor Details

#initialize(output_root:, ucd_version:) ⇒ SkipChecker

Returns a new instance of SkipChecker.

Parameters:

  • output_root (Pathname, String)
  • ucd_version (String)


143
144
145
146
# File 'lib/ucode/code_chart/batch_runner.rb', line 143

def initialize(output_root:, ucd_version:)
  @output_root = Pathname.new(output_root)
  @ucd_version = ucd_version
end

Instance Method Details

#skip?(gap:, block:, pdf_path:) ⇒ Boolean

Returns:

  • (Boolean)


148
149
150
151
152
153
154
155
# File 'lib/ucode/code_chart/batch_runner.rb', line 148

def skip?(gap:, block:, pdf_path:)
  return false unless block_dir(block).exist?

  current_sha = Provenance.sha256_of(pdf_path)
  gap.missing_codepoints.all? do |cp|
    sidecar_matches?(block, cp, current_sha)
  end
end