Class: Ucode::Parsers::PropertyAliases
- Defined in:
- lib/ucode/parsers/property_aliases.rb
Overview
Parses ‘PropertyAliases.txt` — Unicode property short ↔ long name.
Format (UAX #44):
short; long_name; other_alias; other_alias; ...
Example: ‘ccc; Canonical_Combining_Class; ccc`
Class Method Summary collapse
-
.each_record(path) ⇒ Object
Yields one PropertyAlias per non-comment line.
Methods inherited from Base
each_line, parse_codepoint_or_range, parse_field, parse_hex_cp
Class Method Details
.each_record(path) ⇒ Object
Yields one PropertyAlias per non-comment line. Returns a lazy Enumerator when called without a block.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ucode/parsers/property_aliases.rb', line 18 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 short = fields[0] long = fields[1] others = fields[2..].reject { |f| f.nil? || f.empty? } yield Models::PropertyAlias.new( short: short, long: long, other_aliases: others ) end nil end |