Class: Ucode::Repo::Writers::ManifestWriter
- Inherits:
-
Object
- Object
- Ucode::Repo::Writers::ManifestWriter
- Includes:
- AtomicWrites
- Defined in:
- lib/ucode/repo/writers/manifest_writer.rb
Overview
Writes output/manifest.json. The generated_at timestamp is
preserved across no-op re-runs (same content keys → keep old
timestamp) so the byte content is byte-idempotent.
One of the eight per-concern writers split out from AggregateWriter — see Candidate 5 of the 2026-06-29 review.
Instance Method Summary collapse
-
#initialize(output_root:, ucd_version:, codepoint_count:, glyph_count:) ⇒ ManifestWriter
constructor
A new instance of ManifestWriter.
-
#write ⇒ Integer
1 if written, 0 otherwise.
Methods included from AtomicWrites
#same_content?, #to_pretty_json, #write_atomic
Constructor Details
#initialize(output_root:, ucd_version:, codepoint_count:, glyph_count:) ⇒ ManifestWriter
Returns a new instance of ManifestWriter.
37 38 39 40 41 42 |
# File 'lib/ucode/repo/writers/manifest_writer.rb', line 37 def initialize(output_root:, ucd_version:, codepoint_count:, glyph_count:) @output_root = output_root @ucd_version = ucd_version @codepoint_count = codepoint_count @glyph_count = glyph_count end |
Instance Method Details
#write ⇒ Integer
Returns 1 if written, 0 otherwise.
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ucode/repo/writers/manifest_writer.rb', line 45 def write path = Paths.manifest_path(@output_root) content = { "ucd_version" => @ucd_version, "codepoint_count" => @codepoint_count, "glyph_count" => @glyph_count, "schema_version" => SCHEMA_VERSION, } ts = (path, content) payload = content.merge("generated_at" => ts) write_atomic(path, to_pretty_json(payload)) ? 1 : 0 end |