Class: Ucode::Models::Audit::BlockSummary

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/ucode/models/audit/block_summary.rb

Overview

One Unicode block coverage row on an AuditReport.

Replaces fontisan’s ‘AuditBlock`. Carries per-block coverage computed against ucode’s own UCD baseline (not the legacy ucd.all.flat.zip), plus an explicit ‘status` enum so consumers can filter/sort without recomputing from raw counts.

Constant Summary collapse

STATUS_COMPLETE =
"COMPLETE"
STATUS_PARTIAL =
"PARTIAL"
STATUS_UNCOVERED_ASSIGNED =
"UNCOVERED_ASSIGNED"
STATUS_NO_ASSIGNED_IN_BLOCK =
"NO_ASSIGNED_IN_BLOCK"
STATUS_OUTSIDE_BASELINE =
"OUTSIDE_BASELINE"

Class Method Summary collapse

Class Method Details

.derive_status(covered_count:, total_assigned:, in_baseline: true) ⇒ String

Derive the canonical status string for a block given its counts. Centralized so the Aggregations extractor and any downstream consumer compute identically.

Parameters:

  • covered_count (Integer)
  • total_assigned (Integer)
  • in_baseline (Boolean) (defaults to: true)

    false if the block exists in the font’s cmap but not in the resolved baseline (e.g. PUA blocks or a newer Unicode version than ucode knows about).

Returns:

  • (String)

    one of the STATUS_* constants



59
60
61
62
63
64
65
66
67
68
# File 'lib/ucode/models/audit/block_summary.rb', line 59

def self.derive_status(covered_count:, total_assigned:, in_baseline: true)
  return STATUS_OUTSIDE_BASELINE unless in_baseline
  return STATUS_NO_ASSIGNED_IN_BLOCK if total_assigned.zero?

  case covered_count
  when total_assigned then STATUS_COMPLETE
  when 0 then STATUS_UNCOVERED_ASSIGNED
  else STATUS_PARTIAL
  end
end