Class: Ucode::Audit::BlockAggregator
- Inherits:
-
Object
- Object
- Ucode::Audit::BlockAggregator
- Defined in:
- lib/ucode/audit/block_aggregator.rb
Overview
Produces one Models::Audit::BlockSummary per touched Unicode block for a font's cmap codepoint set, compared against a CoverageReference.
Pure transformation: takes a reference + the font's codepoint list, returns BlockSummary. No I/O beyond the reference's lookups, no mutation of inputs.
The "assigned" set for a block comes from
reference.entries_for_block(name). For a UcdOnlyReference
that's every codepoint in the block's UCD ranges. For a
UniversalSetReference it's every codepoint the universal glyph
set built a glyph for in that block — each entry carries tier +
source provenance that gets attached to the missing-codepoint
list (TODO 25).
Instance Method Summary collapse
-
#call(codepoints) ⇒ Array<Models::Audit::BlockSummary>
Sorted by first_cp.
-
#initialize(reference) ⇒ BlockAggregator
constructor
A new instance of BlockAggregator.
Constructor Details
#initialize(reference) ⇒ BlockAggregator
Returns a new instance of BlockAggregator.
26 27 28 |
# File 'lib/ucode/audit/block_aggregator.rb', line 26 def initialize(reference) @reference = coerce_reference(reference) end |
Instance Method Details
#call(codepoints) ⇒ Array<Models::Audit::BlockSummary>
Returns sorted by first_cp.
32 33 34 35 36 37 38 |
# File 'lib/ucode/audit/block_aggregator.rb', line 32 def call(codepoints) return [] if @reference.nil? || codepoints.empty? grouped = group_by_block(codepoints) grouped.filter_map { |name, covered| build_summary(name, covered) } .sort_by(&:first_cp) end |