Class: Ucode::Glyphs::UniversalSet::ManifestWriter

Inherits:
Object
  • Object
show all
Includes:
Idempotency
Defined in:
lib/ucode/glyphs/universal_set/manifest_writer.rb

Overview

Writes the final manifest + reports under the output root.

One manifest, three reports:

  • manifest.json — full Models::UniversalSetManifest.
  • reports/by_tier.jsonby_tier counts alone (small file for quick "how much of the set is tier 1?" inspection).
  • reports/by_block.json — per-block built/skipped totals, computed from the manifest's entries + the codepoint's block_id (resolved by the Builder).
  • reports/gaps.json — array of codepoint integers that resolved to nil (should be empty for a healthy run).

All writes are atomic via Idempotency (which includes Repo::AtomicWrites). Re-running on an unchanged manifest is a no-op modulo generated_at.

Instance Method Summary collapse

Methods included from Idempotency

#by_block_report_path, #by_tier_report_path, #gaps_report_path, #glyph_path, #manifest_path, #write_glyph

Methods included from Repo::AtomicWrites

#same_content?, #to_pretty_json, #write_atomic

Constructor Details

#initialize(output_root) ⇒ ManifestWriter

Returns a new instance of ManifestWriter.

Parameters:

  • output_root (String, Pathname)


31
32
33
# File 'lib/ucode/glyphs/universal_set/manifest_writer.rb', line 31

def initialize(output_root)
  @output_root = Pathname.new(output_root)
end

Instance Method Details

#write(manifest, by_block:, gaps:, failures:) ⇒ Pathname

Write the manifest + reports atomically.

Parameters:

  • manifest (Ucode::Models::UniversalSetManifest)
  • by_block (Hash{String=>Hash})

    per-block breakdown: { "Basic_Latin" => { built: 64, skipped: 0, failed: 0 } }. Computed by the Builder; this writer just serializes it.

  • gaps (Array<Integer>)

    codepoints with no glyph

  • failures (Array<Hash>)

    per-codepoint failures

Returns:

  • (Pathname)

    path to the written manifest



44
45
46
47
48
49
50
51
# File 'lib/ucode/glyphs/universal_set/manifest_writer.rb', line 44

def write(manifest, by_block:, gaps:, failures:)
  write_atomic(manifest_path(@output_root), manifest_to_json(manifest))
  write_atomic(by_tier_report_path(@output_root), to_pretty_json(manifest.by_tier))
  write_atomic(by_block_report_path(@output_root), to_pretty_json(by_block))
  write_atomic(gaps_report_path(@output_root),
               to_pretty_json(gaps: gaps, failures: failures))
  manifest_path(@output_root)
end