Class: TwitterCldr::Resources::RbnfTestImporter

Inherits:
IcuBasedImporter show all
Defined in:
lib/twitter_cldr/resources/rbnf_test_importer.rb

Overview

This class should be used with JRuby in 1.9 mode

Constant Summary collapse

TEST_NUMBERS =

These don’t have much of a pattern, just trying to get a wide range of different possibilities.

[
  [-1_141, -1_142, -1_143],
  [-100, -75, -50, -24],
  (0..100),
  [321, 322, 323, 1_141, 1_142, 1_143, 10_311, 138_400]
  # [41.0, 5.22, 8.90, 555.1212, -14.90, -999.701]  # decimals really aren't supported yet
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output_path, icu4j_path) ⇒ RbnfTestImporter

Returns a new instance of RbnfTestImporter.



28
29
30
31
# File 'lib/twitter_cldr/resources/rbnf_test_importer.rb', line 28

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

Instance Attribute Details

#icu4j_pathObject (readonly)

Returns the value of attribute icu4j_path.



16
17
18
# File 'lib/twitter_cldr/resources/rbnf_test_importer.rb', line 16

def icu4j_path
  @icu4j_path
end

#output_pathObject (readonly)

Returns the value of attribute output_path.



16
17
18
# File 'lib/twitter_cldr/resources/rbnf_test_importer.rb', line 16

def output_path
  @output_path
end

Instance Method Details

#import(locales) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/twitter_cldr/resources/rbnf_test_importer.rb', line 33

def import(locales)
  require_icu4j(icu4j_path)
  java_import 'com.ibm.icu.text.RuleBasedNumberFormat'
  java_import 'com.ibm.icu.util.ULocale'

  groupings = [
    RuleBasedNumberFormat::SPELLOUT,
    RuleBasedNumberFormat::ORDINAL,
    RuleBasedNumberFormat::DURATION
  ]

  import_locales(locales, groupings)
end