Class: Ucode::Models::Script

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/ucode/models/script.rb

Overview

One script assignment from ‘Scripts.txt`. Each row is a single contiguous range; the Coordinator bsearches by `range_first` to find which script covers a given codepoint.

Multiple disjoint ranges can share a script name (e.g. ‘Latin` appears in several ranges). The Repo (TODO 30) groups Script instances by name for the “all Latin codepoints” view; the model here represents one range per instance.

‘code` is the ISO 15924 4-letter code, resolved by the Coordinator via PropertyValueAliases (property=sc). The parser stores the long `name` only; the Coordinator fills `code`.

Instance Method Summary collapse

Instance Method Details

#covers?(codepoint) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/ucode/models/script.rb', line 32

def covers?(codepoint)
  codepoint >= range_first && codepoint <= range_last
end

#sizeObject



36
37
38
# File 'lib/ucode/models/script.rb', line 36

def size
  range_last - range_first + 1
end