Class: Ucode::Audit::Emitter::ScriptEmitter

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

Overview

Writes <face_dir>/scripts/<CODE>.json — one rollup per ISO 15924 script code (Latn, Grek, Hani, …).

The browser fetches these when the user switches to a script-grouped view; cheaper than iterating every block.

Instance Method Summary collapse

Methods included from Repo::AtomicWrites

#same_content?, #to_pretty_json, #write_atomic

Instance Method Details

#emit(face_dir, script) ⇒ Boolean

Returns true if written, false if skipped.

Parameters:

Returns:

  • (Boolean)

    true if written, false if skipped



22
23
24
25
# File 'lib/ucode/audit/emitter/script_emitter.rb', line 22

def emit(face_dir, script)
  write_atomic(Paths.script_under(face_dir, script.script_code),
               to_pretty_json(script.to_hash))
end