Class: Ucode::Parsers::BidiMirroring
- Defined in:
- lib/ucode/parsers/bidi_mirroring.rb
Overview
Parses ‘BidiMirroring.txt` — the bidi mirroring glyph partner.
Format (UAX #44):
cp; mirrored_cp
Coordinator merges each row into ‘CodePoint#bidi.mirroring_glyph_id`.
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
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/ucode/parsers/bidi_mirroring.rb', line 16 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 cp = parse_hex_cp(fields[0]) mirrored_cp = parse_hex_cp(fields[1]) yield Models::BidiMirroring.new( codepoint: cp, mirrored_id: format("U+%04X", mirrored_cp) ) end nil end |