Class: Ucode::Parsers::Scripts
- Defined in:
- lib/ucode/parsers/scripts.rb
Overview
Parses ‘Scripts.txt` — the primary Script property assignment per codepoint range.
Format (UAX #44):
XXXX..XXXX ; Script_Name # trailing comment
XXXX ; Script_Name # trailing comment
Yields one Script per line, with ‘range_first` and `range_last` set. The Coordinator bsearches the resulting sorted array by cp. The ISO 15924 `code` is resolved later by the Coordinator via PropertyValueAliases (property=sc).
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
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ucode/parsers/scripts.rb', line 21 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 name = fields[1] next if name.nil? || name.empty? next if name == "@missing" range = parse_codepoint_or_range(fields[0]) yield build_script(range, name) end nil end |