Class: Ucode::CodeChart::GapAnalyzer::Analyzer
- Inherits:
-
Object
- Object
- Ucode::CodeChart::GapAnalyzer::Analyzer
- Defined in:
- lib/ucode/code_chart/gap_analyzer.rb
Overview
Composes a Manifest parser with the BlockIndex factory to produce BlockGaps.
Instance Method Summary collapse
-
#block_gaps ⇒ Array<BlockGap>
One per block with at least one missing codepoint.
- #each_block_gap {|block_gap| ... } ⇒ Enumerator, void
-
#initialize(manifest:, blocks:, block_index_class: BlockIndex) ⇒ Analyzer
constructor
A new instance of Analyzer.
-
#total_missing_codepoints ⇒ Integer
Sum of missing codepoints across blocks.
Constructor Details
#initialize(manifest:, blocks:, block_index_class: BlockIndex) ⇒ Analyzer
Returns a new instance of Analyzer.
34 35 36 37 38 |
# File 'lib/ucode/code_chart/gap_analyzer.rb', line 34 def initialize(manifest:, blocks:, block_index_class: BlockIndex) @manifest = manifest @blocks = blocks @block_index_class = block_index_class end |
Instance Method Details
#block_gaps ⇒ Array<BlockGap>
Returns one per block with at least one missing codepoint. Blocks with full coverage are excluded.
53 54 55 |
# File 'lib/ucode/code_chart/gap_analyzer.rb', line 53 def block_gaps each_block_gap.to_a end |
#each_block_gap {|block_gap| ... } ⇒ Enumerator, void
42 43 44 45 46 47 48 49 |
# File 'lib/ucode/code_chart/gap_analyzer.rb', line 42 def each_block_gap return enum_for(:each_block_gap) unless block_given? @manifest.coverage_by_block.each_key do |block_id| gap = build_gap(block_id) yield gap unless gap.empty? end end |
#total_missing_codepoints ⇒ Integer
Returns sum of missing codepoints across blocks.
58 59 60 |
# File 'lib/ucode/code_chart/gap_analyzer.rb', line 58 def total_missing_codepoints block_gaps.sum(&:size) end |