Class: Ucode::Audit::CoverageReference

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

Overview

Common interface for any "what is the assigned codepoint set" reference used by the audit pipeline.

Two implementations:

  • UcdOnlyReference — derives the assigned set from the UCD database alone (block ranges). Carries no per-codepoint provenance. This is the legacy behaviour: a font audit compares against the abstract Unicode assigned-codepoint list.

  • UniversalSetReference — derives the assigned set from a universal-set manifest (TODO 24). Every codepoint carries tier + source provenance, so a missing-codepoint report can answer "what does the missing glyph look like, and where did the universal set get it from?".

The audit pipeline (Context → Aggregations extractor → BlockAggregator) talks exclusively to this interface. Adding a new reference kind = one new subclass; no caller changes (open/closed).

Direct Known Subclasses

UcdOnlyReference, UniversalSetReference

Defined Under Namespace

Classes: Entry

Instance Method Summary collapse

Constructor Details

#initializeCoverageReference

Returns a new instance of CoverageReference.



37
# File 'lib/ucode/audit/coverage_reference.rb', line 37

def initialize; end

Instance Method Details

#block_name_for(codepoint) ⇒ String?

Block name (verbatim Unicode identifier, e.g. "Basic_Latin") the codepoint falls under, or nil if it isn't in any known block. Used by BlockAggregator to group a font's cmap by block without needing direct access to the underlying Database.

Parameters:

  • codepoint (Integer)

Returns:

  • (String, nil)

Raises:

  • (NotImplementedError)


62
63
64
# File 'lib/ucode/audit/coverage_reference.rb', line 62

def block_name_for(codepoint)
  raise NotImplementedError
end

#entries_for_block(block_id) ⇒ Array<Entry>

Every assigned codepoint in the block, with tier + source attached when the reference carries provenance.

Parameters:

  • block_id (String)

    verbatim Unicode block name (e.g. "Basic_Latin", "Greek_and_Coptic")

Returns:

  • (Array<Entry>)

    sorted by codepoint; empty for unknown block names or blocks with no assigned codepoints

Raises:

  • (NotImplementedError)


73
74
75
# File 'lib/ucode/audit/coverage_reference.rb', line 73

def entries_for_block(block_id)
  raise NotImplementedError
end

#include?(codepoint) ⇒ Boolean

Returns true if the codepoint is in the reference set.

Parameters:

  • codepoint (Integer)

Returns:

  • (Boolean)

    true if the codepoint is in the reference set

Raises:

  • (NotImplementedError)


50
51
52
# File 'lib/ucode/audit/coverage_reference.rb', line 50

def include?(codepoint)
  raise NotImplementedError
end

#kindSymbol

Symbol identifying the reference kind. Used by the audit report's baseline.reference_kind field so consumers know which reference produced the per-block counts.

Returns:

  • (Symbol)

    e.g. :ucd, :universal_set

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/ucode/audit/coverage_reference.rb', line 44

def kind
  raise NotImplementedError
end

#provenance_for(codepoints) ⇒ Array<Hash{Symbol=>Object}>?

Provenance rows for a list of codepoints, or nil when the reference carries no provenance (UCD-only). Returning nil (rather than an empty array) is the signal that the audit report should omit the missing_codepoint_provenance field entirely — preserving the legacy wire shape for UCD-only audits.

Parameters:

  • codepoints (Enumerable<Integer>)

Returns:

  • (Array<Hash{Symbol=>Object}>, nil)

    one hash per codepoint with :codepoint, :tier, :source keys; or nil

Raises:

  • (NotImplementedError)


98
99
100
# File 'lib/ucode/audit/coverage_reference.rb', line 98

def provenance_for(codepoints)
  raise NotImplementedError
end

#reference_idString

Stable identifier for the reference, embedded in audit reports so consumers can detect drift. Examples:

"ucd:17.0.0"
"universal-set:17.0.0:abc12345"

Returns:

  • (String)

Raises:

  • (NotImplementedError)


84
85
86
# File 'lib/ucode/audit/coverage_reference.rb', line 84

def reference_id
  raise NotImplementedError
end