Class: Ucode::Audit::Release::LibraryIndexBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/ucode/audit/release/library_index_builder.rb

Overview

Pure builder for the release-level library.json (TODO 27).

Aggregates a list of FormulaAudits into a single Hash shape consumed by fontist.org's renderer. Each formula contributes a formula card with its face cards; the renderer iterates the formula list to build its font index.

The shape mirrors Emitter::LibraryEmitter#build_index but adds the formula layer. Paths are relative to the release root so the JSON is portable across hosts.

Pure: no I/O, no global state. Caller writes the result.

Instance Method Summary collapse

Instance Method Details

#build(formulas:, release_root:, generated_at:, ucode_version:) ⇒ Hash

Parameters:

  • formulas (Array<FormulaAudits>)
  • release_root (String, Pathname)
  • generated_at (String)

    ISO8601 timestamp

  • ucode_version (String)

Returns:

  • (Hash)


30
31
32
33
34
35
36
37
38
39
# File 'lib/ucode/audit/release/library_index_builder.rb', line 30

def build(formulas:, release_root:, generated_at:, ucode_version:)
  @release_root = release_root
  {
    "generated_at" => generated_at,
    "ucode_version" => ucode_version,
    "formulas_total" => formulas.size,
    "faces_total" => formulas.sum(&:faces_total),
    "formulas" => formulas.map { |fa| formula_card(fa) },
  }
end