ruby-cldr 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/Gemfile +7 -0
  2. data/Gemfile.lock +23 -0
  3. data/README.textile +9 -6
  4. data/VERSION +1 -1
  5. data/lib/cldr.rb +1 -1
  6. data/lib/cldr/data.rb +9 -29
  7. data/lib/cldr/download.rb +2 -2
  8. data/lib/cldr/export.rb +8 -2
  9. data/lib/cldr/export/code.rb +34 -0
  10. data/lib/cldr/export/code/numbers.rb +29 -0
  11. data/lib/cldr/export/data.rb +36 -0
  12. data/lib/cldr/export/data/base.rb +61 -0
  13. data/lib/cldr/export/data/calendars.rb +14 -0
  14. data/lib/cldr/export/data/calendars/gregorian.rb +142 -0
  15. data/lib/cldr/export/data/currencies.rb +28 -0
  16. data/lib/cldr/export/data/delimiters.rb +29 -0
  17. data/lib/cldr/export/data/languages.rb +19 -0
  18. data/lib/cldr/export/data/numbers.rb +67 -0
  19. data/lib/cldr/export/data/plurals.rb +41 -0
  20. data/lib/cldr/{data → export/data}/plurals/cldr_grammar.treetop +0 -0
  21. data/lib/cldr/export/data/plurals/grammar.rb +538 -0
  22. data/lib/cldr/export/data/plurals/rules.rb +119 -0
  23. data/lib/cldr/export/data/territories.rb +19 -0
  24. data/lib/cldr/export/data/timezones.rb +27 -0
  25. data/lib/cldr/export/data/units.rb +29 -0
  26. data/lib/cldr/export/ruby.rb +1 -1
  27. data/lib/cldr/export/yaml.rb +1 -1
  28. data/lib/cldr/format.rb +1 -97
  29. data/lib/cldr/format/currency.rb +1 -1
  30. data/lib/cldr/format/date.rb +1 -1
  31. data/lib/cldr/format/datetime.rb +14 -18
  32. data/lib/cldr/format/datetime/base.rb +1 -1
  33. data/lib/cldr/format/decimal.rb +1 -1
  34. data/lib/cldr/format/decimal/base.rb +1 -1
  35. data/lib/cldr/format/decimal/fraction.rb +1 -1
  36. data/lib/cldr/format/decimal/integer.rb +1 -1
  37. data/lib/cldr/format/decimal/number.rb +1 -1
  38. data/lib/cldr/format/percent.rb +1 -1
  39. data/lib/cldr/format/time.rb +1 -1
  40. data/lib/cldr/thor.rb +3 -3
  41. data/test/all.rb +1 -1
  42. data/test/export/code/numbers_test.rb +11 -0
  43. data/test/{data → export/data}/all.rb +1 -1
  44. data/test/{data → export/data}/calendars_test.rb +18 -18
  45. data/test/{data → export/data}/currencies_test.rb +6 -6
  46. data/test/{data → export/data}/delimiters_test.rb +6 -6
  47. data/test/{data → export/data}/languages_test.rb +6 -6
  48. data/test/{data → export/data}/numbers_test.rb +8 -8
  49. data/test/export/data/plurals_test.rb +141 -0
  50. data/test/{data → export/data}/territories_test.rb +6 -6
  51. data/test/{data → export/data}/timezones_test.rb +6 -6
  52. data/test/{data → export/data}/units_test.rb +6 -6
  53. data/test/export_test.rb +8 -8
  54. data/test/{formats → format}/all.rb +1 -1
  55. data/test/format/currency_test.rb +0 -0
  56. data/test/format/date_test.rb +265 -0
  57. data/test/format/datetime_test.rb +18 -0
  58. data/test/{formats → format}/decimal/fraction_test.rb +4 -4
  59. data/test/{formats → format}/decimal/integer_test.rb +17 -17
  60. data/test/{formats → format}/decimal/number_test.rb +19 -19
  61. data/test/{formats → format}/decimal_test.rb +5 -5
  62. data/test/format/percent_test.rb +0 -0
  63. data/test/format/time_test.rb +195 -0
  64. data/test/test_autotest.rb +36 -0
  65. data/test/test_helper.rb +16 -1
  66. metadata +124 -114
  67. data/lib/cldr/data/base.rb +0 -66
  68. data/lib/cldr/data/calendars.rb +0 -12
  69. data/lib/cldr/data/calendars/gregorian.rb +0 -124
  70. data/lib/cldr/data/currencies.rb +0 -26
  71. data/lib/cldr/data/delimiters.rb +0 -21
  72. data/lib/cldr/data/languages.rb +0 -17
  73. data/lib/cldr/data/numbers.rb +0 -60
  74. data/lib/cldr/data/plurals.rb +0 -39
  75. data/lib/cldr/data/plurals/grammar.rb +0 -536
  76. data/lib/cldr/data/plurals/rules.rb +0 -113
  77. data/lib/cldr/data/territories.rb +0 -17
  78. data/lib/cldr/data/timezones.rb +0 -25
  79. data/lib/cldr/data/units.rb +0 -25
  80. data/test/data/plurals_test.rb +0 -132
  81. data/test/formats/datetime/all.rb +0 -3
  82. data/test/formats/datetime/date_test.rb +0 -31
  83. data/test/formats/datetime/datetime_test.rb +0 -18
  84. data/test/formats/datetime/day_test.rb +0 -41
  85. data/test/formats/datetime/hour_test.rb +0 -79
  86. data/test/formats/datetime/minute_test.rb +0 -25
  87. data/test/formats/datetime/month_test.rb +0 -76
  88. data/test/formats/datetime/period_test.rb +0 -20
  89. data/test/formats/datetime/quarter_test.rb +0 -118
  90. data/test/formats/datetime/second_test.rb +0 -80
  91. data/test/formats/datetime/time_test.rb +0 -33
  92. data/test/formats/datetime/timezone_test.rb +0 -23
  93. data/test/formats/datetime/year_test.rb +0 -57
  94. data/test/formats/format_test.rb +0 -66
  95. data/test/formats/rails_compat/all.rb +0 -3
  96. data/test/formats/rails_compat/format_integer_test.rb +0 -56
  97. data/test/formats/rails_compat/format_number_test.rb +0 -134
@@ -1,3 +0,0 @@
1
- Dir["#{File.dirname(__FILE__)}/**/*_test.rb"].each do |filename|
2
- require filename
3
- end
@@ -1,56 +0,0 @@
1
- # # encoding: utf-8
2
- # require File.dirname(__FILE__) + '/../../test_helper'
3
- #
4
- # class TestCldrFormatIntegerRailsCompat < Test::Unit::TestCase
5
- # def setup
6
- # @options = { :decimal => ".", :group => ",", :format => "#,##0.###" }
7
- # end
8
- #
9
- # def format_integer(number, options = {})
10
- # Cldr::Format.format_integer(number, @options.merge(options))
11
- # end
12
- #
13
- # define_method :"test: compatible with number_with_delimiter: 12345678 => 12,345,678" do
14
- # assert_equal '12,345,678', format_integer(12345678)
15
- # end
16
- #
17
- # define_method :"test: compatible with number_with_delimiter: 0 => 0" do
18
- # assert_equal '0', format_integer(0)
19
- # end
20
- #
21
- # define_method :"test: compatible with number_with_delimiter: 123 => 123" do
22
- # assert_equal '123', format_integer(123)
23
- # end
24
- #
25
- # define_method :"test: compatible with number_with_delimiter: 123456 => 123,456" do
26
- # assert_equal '123,456', format_integer(123456)
27
- # end
28
- #
29
- # define_method :"test: NOT compatible with number_with_delimiter: 123456.78 => 123,457" do
30
- # assert_equal '123,457', format_integer(123456.78)
31
- # end
32
- #
33
- # define_method :"test: NOT compatible with number_with_delimiter: 123456.789 => 123,457" do
34
- # assert_equal '123,457', format_integer(123456.789)
35
- # end
36
- #
37
- # define_method :"test: NOT compatible with number_with_delimiter: 123456.78901 => 123,457" do
38
- # assert_equal '123,457', format_integer(123456.78901)
39
- # end
40
- #
41
- # define_method :"test: NOT compatible with number_with_delimiter: 123456789.78901 => 123,456,790" do
42
- # assert_equal '123,456,790', format_integer(123456789.78901)
43
- # end
44
- #
45
- # define_method :"test: NOT compatible with number_with_delimiter: 0.78901 => 0" do
46
- # assert_equal '1', format_integer(0.78901)
47
- # end
48
- #
49
- # define_method :"test: compatible with number_with_delimiter: 'x' => 'x'" do
50
- # assert_equal 'x', format_integer('x')
51
- # end
52
- #
53
- # define_method :"test: compatible with number_with_delimiter: nil => nil" do
54
- # assert_nil format_integer(nil)
55
- # end
56
- # end
@@ -1,134 +0,0 @@
1
- # # encoding: utf-8
2
- # require File.dirname(__FILE__) + '/../../test_helper'
3
- #
4
- # class TestCldrFormatRailsCompat < Test::Unit::TestCase
5
- # def setup
6
- # @options = { :decimal => ".", :group => ",", :format => "#,##0.###" }
7
- # end
8
- #
9
- # def format_number(number, options = {})
10
- # Cldr::Format.format_number(number, @options.merge(options))
11
- # end
12
- #
13
- # # number_with_delimiter assertions:
14
- # #
15
- # # assert_equal("12,345,678", number_with_delimiter(12345678))
16
- # # assert_equal("0", number_with_delimiter(0))
17
- # # assert_equal("123", number_with_delimiter(123))
18
- # # assert_equal("123,456", number_with_delimiter(123456))
19
- # # assert_equal("123,456.78", number_with_delimiter(123456.78))
20
- # # assert_equal("123,456.789", number_with_delimiter(123456.789))
21
- # # assert_equal("123,456.78901", number_with_delimiter(123456.78901))
22
- # # assert_equal("123,456,789.78901", number_with_delimiter(123456789.78901))
23
- # # assert_equal("0.78901", number_with_delimiter(0.78901))
24
- # # assert_equal("123,456.78", number_with_delimiter("123456.78"))
25
- # # assert_equal("x", number_with_delimiter("x"))
26
- # # assert_nil number_with_delimiter(nil)
27
- # # define_method :"test: NOT compatible with number_with_delimiter: 12345678 => 12,345,678.0" do
28
- # # assert_equal '12,345,678.0', format_number(12345678)
29
- # # end
30
- # #
31
- # # define_method :"test: NOT compatible with number_with_delimiter: 0 => 0.0" do
32
- # # assert_equal '0.0', format_number(0)
33
- # # end
34
- # #
35
- # # define_method :"test: NOT compatible with number_with_delimiter: 123 => 123.0" do
36
- # # assert_equal '123.0', format_number(123)
37
- # # end
38
- # #
39
- # # define_method :"test: NOT compatible with number_with_delimiter: 123456 => 123,456" do
40
- # # assert_equal '123,456.0', format_number(123456)
41
- # # end
42
- # #
43
- # # define_method :"test: compatible with number_with_delimiter: 123456.78 => 123,456.78" do
44
- # # assert_equal '123,456.78', format_number(123456.78)
45
- # # end
46
- # #
47
- # # define_method :"test: compatible with number_with_delimiter: 123456.789 => 123,456.789" do
48
- # # assert_equal '123,456.789', format_number(123456.789)
49
- # # end
50
- # #
51
- # # define_method :"test: NOT compatible with number_with_delimiter: 123456.78901 => 123,456.789" do
52
- # # assert_equal '123,456.789', format_number(123456.78901)
53
- # # end
54
- # #
55
- # # define_method :"test: NOT compatible with number_with_delimiter: 123456.78901 w/ precision 5 => 123,456.78901" do
56
- # # assert_equal '123,456.78901', format_number(123456.78901, :precision => 5)
57
- # # end
58
- # #
59
- # # define_method :"test: NOT compatible with number_with_delimiter: 123456789.78901 => 123,456,789.789" do
60
- # # assert_equal '123,456,789.789', format_number(123456789.78901)
61
- # # end
62
- # #
63
- # # define_method :"test: NOT compatible with number_with_delimiter: 123456789.78901 w/ precision 5 => 123,456,789.78901" do
64
- # # assert_equal '123,456,789.78901', format_number(123456789.78901, :precision => 5)
65
- # # end
66
- # #
67
- # # define_method :"test: NOT compatible with number_with_delimiter: 0.78901 => 0.789" do
68
- # # assert_equal '0.789', format_number(0.78901)
69
- # # end
70
- # #
71
- # # define_method :"test: NOT compatible with number_with_delimiter: 0.78901 w/ precision 5 => 0.78901" do
72
- # # assert_equal '0.78901', format_number(0.78901, :precision => 5)
73
- # # end
74
- # #
75
- # # define_method :"test: compatible with number_with_delimiter: 'x' => 'x'" do
76
- # # assert_equal 'x', format_number('x')
77
- # # end
78
- # #
79
- # # define_method :"test: compatible with number_with_delimiter: nil => nil" do
80
- # # assert_nil format_number(nil)
81
- # # end
82
- #
83
- # # number_with_precision assertions:
84
- # #
85
- # # assert_equal("111.235", number_with_precision(111.2346))
86
- # # assert_equal("31.83", number_with_precision(31.825, :precision => 2))
87
- # # assert_equal("111.23", number_with_precision(111.2346, :precision => 2))
88
- # # assert_equal("111.00", number_with_precision(111, :precision => 2))
89
- # # assert_equal("111.235", number_with_precision("111.2346"))
90
- # # assert_equal("31.83", number_with_precision("31.825", :precision => 2))
91
- # # assert_equal("112", number_with_precision(111.50, :precision => 0))
92
- # # assert_equal("1234567892", number_with_precision(1234567891.50, :precision => 0))
93
- # # assert_equal("x", number_with_precision("x"))
94
- # # assert_nil number_with_precision(nil)
95
- # define_method :"test: compatible with number_with_precision: 111.235 => 111.2346" do
96
- # assert_equal "111.235", format_number(111.2346)
97
- # end
98
- #
99
- # define_method :"test: compatible with number_with_precision: 31.825 w/ precision 2 => 31.83" do
100
- # assert_equal "31.83", format_number(31.825, :precision => 2)
101
- # end
102
- #
103
- # # define_method :"test: compatible with number_with_precision: 111.2346 w/ precision 2 => 111.23" do
104
- # # assert_equal "111.23", format_number(111.2346, :precision => 2)
105
- # # end
106
- # #
107
- # # define_method :"test: compatible with number_with_precision: 111 w/ precision 2 => 111.00" do
108
- # # assert_equal "111.00", format_number(111, :precision => 2)
109
- # # end
110
- # #
111
- # # define_method :"test: compatible with number_with_precision: '111.2346' => '111.235'" do
112
- # # assert_equal "111.235", format_number("111.2346")
113
- # # end
114
- # #
115
- # # define_method :"test: compatible with number_with_precision: '31.825' w/ precision 2 => 31.83" do
116
- # # assert_equal "31.83", format_number("31.825", :precision => 2)
117
- # # end
118
- # #
119
- # # define_method :"test: compatible with number_with_precision: 111.50 w/ precision 0 => 112" do
120
- # # assert_equal "112", format_number(111.50, :precision => 0)
121
- # # end
122
- # #
123
- # # define_method :"test: NOT compatible with number_with_precision: 1234567891.50 w/ precision 0 => 1,234,567,892" do
124
- # # assert_equal "1,234,567,892", format_number(1234567891.50, :precision => 0)
125
- # # end
126
- # #
127
- # # define_method :"test: compatible with number_with_precision: 'x' => 'x'" do
128
- # # assert_equal "x", format_number("x")
129
- # # end
130
- # #
131
- # # define_method :"test: compatible with number_with_precision: nil => nil" do
132
- # # assert_nil format_number(nil)
133
- # # end
134
- # end