Class: Ucode::Audit::PlaneAggregator

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

Overview

Rolls up Models::Audit::BlockSummary[] into one Models::Audit::PlaneSummary per Unicode plane.

Pure transformation: input is BlockSummary[], output is PlaneSummary[] sorted by plane number. No I/O, no Database access — the per-block work is already done.

Instance Method Summary collapse

Instance Method Details

#call(block_summaries) ⇒ Array<Models::Audit::PlaneSummary>

Returns sorted by plane.

Parameters:

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ucode/audit/plane_aggregator.rb', line 14

def call(block_summaries)
  block_summaries.group_by(&:plane).map do |plane, blocks|
    assigned = blocks.sum(&:total_assigned)
    covered = blocks.sum(&:covered_count)
    Models::Audit::PlaneSummary.new(
      plane: plane,
      blocks_total: blocks.size,
      assigned_total: assigned,
      covered_total: covered,
      coverage_percent: percent(covered, assigned),
    )
  end.sort_by(&:plane)
end