Class: TwitterCldr::Resources::NormalizationQuickCheckImporter

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/resources/normalization_quick_check_importer.rb

Constant Summary collapse

PROPS_FILE_URL =
"ftp://ftp.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt"

Instance Method Summary collapse

Constructor Details

#initialize(input_path, output_path) ⇒ NormalizationQuickCheckImporter

Arguments:

input_path  - path to a directory containing DerivedNormalizationProps.txt
output_path - output directory for imported YAML files


20
21
22
23
# File 'lib/twitter_cldr/resources/normalization_quick_check_importer.rb', line 20

def initialize(input_path, output_path)
  @input_path  = input_path
  @output_path = output_path
end

Instance Method Details

#importObject



25
26
27
28
29
30
31
# File 'lib/twitter_cldr/resources/normalization_quick_check_importer.rb', line 25

def import
  parse_props_file.each_pair do |algorithm, code_point_list|
    File.open(File.join(@output_path, "#{algorithm.downcase}_quick_check.yml"), "w+") do |f|
      f.write(YAML.dump(TwitterCldr::Utils::RangeSet.rangify(code_point_list)))
    end
  end
end