Module: TwitterCldr::Collation::TrieBuilder

Defined in:
lib/twitter_cldr/collation/trie_builder.rb

Overview

Builds a fractional collation elements Trie from the file containing a fractional collation elements table.

Constant Summary collapse

COLLATION_ELEMENT_REGEXP =
/^((?:[0-9A-F]+)(?:\s[0-9A-F]+)*);\s((?:\[.*?\])(?:\[.*?\])*)/
FRACTIONAL_UCA_SHORT_PATH =
File.join(TwitterCldr::RESOURCES_DIR, 'collation', 'FractionalUCA_SHORT.txt')

Class Method Summary collapse

Class Method Details

.load_default_trieObject



19
20
21
# File 'lib/twitter_cldr/collation/trie_builder.rb', line 19

def load_default_trie
  File.open(FRACTIONAL_UCA_SHORT_PATH, 'r') { |table| parse_collation_elements_table(table) }
end

.load_tailored_trie(locale, fallback) ⇒ Object



23
24
25
# File 'lib/twitter_cldr/collation/trie_builder.rb', line 23

def load_tailored_trie(locale, fallback)
  build_tailored_trie(tailoring_data(locale), fallback)
end

.tailoring_data(locale) ⇒ Object



27
28
29
# File 'lib/twitter_cldr/collation/trie_builder.rb', line 27

def tailoring_data(locale)
  TwitterCldr.get_resource(:collation, :tailoring, locale)
end