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 ucode UCD baseline.
Pure transformation: takes the resolved baseline Database + the font’s codepoint list, returns BlockSummary[]. No I/O beyond the database lookups, no mutation of inputs.
The “assigned” set for a block is derived from the Database’s ranges-with-that-name. The Database stores coalesced runs of consecutive assigned codepoints grouped by block name, so the union of those ranges IS the assigned set for that block.
Instance Method Summary collapse
-
#call(codepoints) ⇒ Array<Models::Audit::BlockSummary>
Sorted by first_cp.
-
#initialize(database) ⇒ BlockAggregator
constructor
A new instance of BlockAggregator.
Constructor Details
#initialize(database) ⇒ BlockAggregator
Returns a new instance of BlockAggregator.
21 22 23 |
# File 'lib/ucode/audit/block_aggregator.rb', line 21 def initialize(database) @database = database end |
Instance Method Details
#call(codepoints) ⇒ Array<Models::Audit::BlockSummary>
Returns sorted by first_cp.
27 28 29 30 31 32 33 |
# File 'lib/ucode/audit/block_aggregator.rb', line 27 def call(codepoints) return [] if @database.nil? || codepoints.empty? grouped = group_by_block(codepoints) grouped.map { |name, covered| build_summary(name, covered) } .sort_by(&:first_cp) end |