Module: UnicodedataRb
- Defined in:
- lib/unicodedata_rb/codepoint.rb,
lib/unicodedata_rb.rb,
lib/unicodedata_rb/version.rb,
lib/unicodedata_rb/constants.rb,
lib/unicodedata_rb/generate_index.rb
Overview
Defined Under Namespace
Classes: Codepoint, Constants, GenerateIndex
Constant Summary
collapse
- VERSION =
"0.1.0"
- CODEPOINT_FIELDS =
[
:codepoint, :name, :category, :combining_class, :bidi_class,
:decomposition, :digit_value, :non_decimal_digit_value,
:numeric_value, :bidi_mirrored, :unicode1_name, :iso_comment,
:simple_uppercase_map, :simple_lowercase_map, :simple_titlecase_map,
]
- NUMERIC_FIELDS =
[:digit_value, :non_decimal_digit_value, :numeric_value]
Class Method Summary
collapse
Class Method Details
._unicodedata_index ⇒ Object
._unicodedata_txt_file ⇒ Object
._unicodedata_txt_line_from(codepoint: nil, name: nil) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/unicodedata_rb.rb', line 19
def self._unicodedata_txt_line_from(codepoint: nil, name: nil)
raise ArgumentError if (codepoint.nil? && name.nil?) || (!codepoint.nil? && !name.nil?)
_unicodedata_txt_file.rewind
offset =
if !codepoint.nil?
_unicodedata_index[:codepoint][codepoint]
else
_unicodedata_index[:name][name]
end
raise ArgumentError if offset.nil?
_unicodedata_txt_file.seek offset
_unicodedata_txt_file.readline.chomp
end
|
.codepoint_from_char(c) ⇒ Object
11
12
13
|
# File 'lib/unicodedata_rb.rb', line 11
def self.codepoint_from_char(c)
UnicodedataRb::Codepoint.from_line _unicodedata_txt_line_from(codepoint: c.ord)
end
|
.codepoint_from_name(name) ⇒ Object
15
16
17
|
# File 'lib/unicodedata_rb.rb', line 15
def self.codepoint_from_name(name)
UnicodedataRb::Codepoint.from_line _unicodedata_txt_line_from(name:)
end
|