Class: Ucode::Parsers::DerivedAge
- Defined in:
- lib/ucode/parsers/derived_age.rb
Overview
Parses ‘DerivedAge.txt` — the Unicode version in which each codepoint was first assigned.
Format (UAX #44):
XXXX..YYYY; M.N
XXXX; M.N
The age is a Unicode version string like “1.1”, “5.2”, “15.0”. Coordinator merges each row into ‘CodePoint#age`.
Ranges are expanded per-codepoint (one Tuple per cp) because the Coordinator needs per-cp assignment for ‘CodePoint#age`.
Defined Under Namespace
Classes: Tuple
Class Method Summary collapse
Methods inherited from Base
each_line, parse_codepoint_or_range, parse_field, parse_hex_cp
Class Method Details
.each_record(path) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ucode/parsers/derived_age.rb', line 30 def each_record(path) return enum_for(:each_record, path) unless block_given? each_line(path) do |line| fields = line.fields next if fields.length < 2 range = parse_codepoint_or_range(fields[0]) age = fields[1] next if age.nil? || age.empty? each_cp(range) { |cp| yield Tuple.new(cp: cp, age: age) } end nil end |