Class: Ucode::Audit::Emitter::BlockEmitter

Inherits:
Object
  • Object
show all
Includes:
Repo::AtomicWrites
Defined in:
lib/ucode/audit/emitter/block_emitter.rb

Overview

Writes <face_dir>/blocks/<NAME>.json — one file per touched block.

The filename uses the block name verbatim (no slugifying) per 03-directory-output-spec.md §"Block filename encoding". The only character that needs escaping is /, which Unicode block names never contain today.

Each file is a single BlockSummary serialized via lutaml-model. The browser fetches these lazily when the user expands a block in the coverage map.

Instance Method Summary collapse

Methods included from Repo::AtomicWrites

#same_content?, #to_pretty_json, #write_atomic

Instance Method Details

#emit(face_dir, block) ⇒ Boolean

Returns true if written, false if skipped.

Parameters:

Returns:

  • (Boolean)

    true if written, false if skipped



28
29
30
31
# File 'lib/ucode/audit/emitter/block_emitter.rb', line 28

def emit(face_dir, block)
  path = Paths.block_under(face_dir, encode_name(block.name))
  write_atomic(path, to_pretty_json(serialize_block(block)))
end