numbers_and_words 0.11.5 → 0.11.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +5 -5
  2. data/README.rdoc +49 -9
  3. data/lib/numbers_and_words.rb +2 -0
  4. data/lib/numbers_and_words/core_ext.rb +2 -0
  5. data/lib/numbers_and_words/core_ext/array.rb +2 -0
  6. data/lib/numbers_and_words/core_ext/float.rb +2 -0
  7. data/lib/numbers_and_words/core_ext/integer.rb +2 -0
  8. data/lib/numbers_and_words/helper_classes.rb +2 -0
  9. data/lib/numbers_and_words/helper_classes/array_extensions/helpers.rb +6 -4
  10. data/lib/numbers_and_words/helper_classes/figures_array.rb +8 -2
  11. data/lib/numbers_and_words/helper_classes/words_array.rb +4 -2
  12. data/lib/numbers_and_words/i18n.rb +2 -0
  13. data/lib/numbers_and_words/i18n/initialization.rb +2 -0
  14. data/lib/numbers_and_words/i18n/locales/numbers.kz.yml +7 -0
  15. data/lib/numbers_and_words/i18n/pluralization.rb +3 -1
  16. data/lib/numbers_and_words/i18n/plurals/cs.rb +2 -0
  17. data/lib/numbers_and_words/i18n/plurals/fr.rb +2 -0
  18. data/lib/numbers_and_words/i18n/plurals/lt.rb +2 -0
  19. data/lib/numbers_and_words/i18n/plurals/lv.rb +2 -0
  20. data/lib/numbers_and_words/i18n/plurals/plurals.rb +2 -0
  21. data/lib/numbers_and_words/i18n/plurals/ru.rb +2 -0
  22. data/lib/numbers_and_words/i18n/plurals/ua.rb +2 -0
  23. data/lib/numbers_and_words/strategies.rb +2 -0
  24. data/lib/numbers_and_words/strategies/array_joiner.rb +2 -0
  25. data/lib/numbers_and_words/strategies/array_joiner/languages.rb +2 -0
  26. data/lib/numbers_and_words/strategies/array_joiner/languages/base.rb +2 -0
  27. data/lib/numbers_and_words/strategies/array_joiner/languages/cs.rb +2 -0
  28. data/lib/numbers_and_words/strategies/array_joiner/languages/en-GB.rb +2 -0
  29. data/lib/numbers_and_words/strategies/array_joiner/languages/en.rb +2 -0
  30. data/lib/numbers_and_words/strategies/array_joiner/languages/es.rb +2 -0
  31. data/lib/numbers_and_words/strategies/array_joiner/languages/families/base.rb +2 -0
  32. data/lib/numbers_and_words/strategies/array_joiner/languages/fr.rb +2 -0
  33. data/lib/numbers_and_words/strategies/array_joiner/languages/hu.rb +2 -0
  34. data/lib/numbers_and_words/strategies/array_joiner/languages/pt-BR.rb +2 -0
  35. data/lib/numbers_and_words/strategies/array_joiner/languages/ru.rb +2 -0
  36. data/lib/numbers_and_words/strategies/array_joiner/languages/ua.rb +2 -0
  37. data/lib/numbers_and_words/strategies/array_joiner/languages/vi.rb +2 -0
  38. data/lib/numbers_and_words/strategies/figures_converter.rb +4 -2
  39. data/lib/numbers_and_words/strategies/figures_converter/decorators.rb +2 -0
  40. data/lib/numbers_and_words/strategies/figures_converter/decorators/base.rb +2 -0
  41. data/lib/numbers_and_words/strategies/figures_converter/decorators/cs.rb +2 -0
  42. data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/base.rb +2 -0
  43. data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/fractional.rb +2 -0
  44. data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/integral.rb +3 -0
  45. data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB.rb +2 -0
  46. data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/base.rb +2 -0
  47. data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/fractional.rb +2 -0
  48. data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/integral.rb +2 -0
  49. data/lib/numbers_and_words/strategies/figures_converter/decorators/en.rb +2 -0
  50. data/lib/numbers_and_words/strategies/figures_converter/decorators/en/base.rb +2 -0
  51. data/lib/numbers_and_words/strategies/figures_converter/decorators/en/fractional.rb +2 -0
  52. data/lib/numbers_and_words/strategies/figures_converter/decorators/en/integral.rb +2 -0
  53. data/lib/numbers_and_words/strategies/figures_converter/decorators/es.rb +2 -0
  54. data/lib/numbers_and_words/strategies/figures_converter/decorators/es/base.rb +2 -0
  55. data/lib/numbers_and_words/strategies/figures_converter/decorators/es/fractional.rb +3 -1
  56. data/lib/numbers_and_words/strategies/figures_converter/decorators/es/integral.rb +2 -0
  57. data/lib/numbers_and_words/strategies/figures_converter/decorators/fr.rb +2 -0
  58. data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/base.rb +2 -0
  59. data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/fractional.rb +2 -0
  60. data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/integral.rb +2 -0
  61. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu.rb +2 -0
  62. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/base.rb +2 -0
  63. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/fractional.rb +2 -0
  64. data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/integral.rb +2 -0
  65. data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR.rb +2 -0
  66. data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/base.rb +2 -0
  67. data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/fractional.rb +2 -0
  68. data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/integral.rb +2 -0
  69. data/lib/numbers_and_words/strategies/figures_converter/decorators/ru.rb +2 -0
  70. data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/base.rb +2 -0
  71. data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/fractional.rb +2 -0
  72. data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/integral.rb +2 -0
  73. data/lib/numbers_and_words/strategies/figures_converter/decorators/ua.rb +2 -0
  74. data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/base.rb +2 -0
  75. data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/fractional.rb +2 -0
  76. data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/integral.rb +2 -0
  77. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb +2 -0
  78. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/base.rb +2 -0
  79. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb +2 -0
  80. data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb +2 -0
  81. data/lib/numbers_and_words/strategies/figures_converter/languages.rb +3 -0
  82. data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +2 -0
  83. data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +2 -0
  84. data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +2 -0
  85. data/lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb +2 -0
  86. data/lib/numbers_and_words/strategies/figures_converter/languages/en.rb +3 -7
  87. data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +11 -11
  88. data/lib/numbers_and_words/strategies/figures_converter/languages/et.rb +2 -0
  89. data/lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb +2 -0
  90. data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +2 -0
  91. data/lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb +2 -0
  92. data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +2 -0
  93. data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +2 -0
  94. data/lib/numbers_and_words/strategies/figures_converter/languages/hy.rb +2 -0
  95. data/lib/numbers_and_words/strategies/figures_converter/languages/it.rb +2 -0
  96. data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +2 -0
  97. data/lib/numbers_and_words/strategies/figures_converter/languages/kz.rb +12 -0
  98. data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +2 -0
  99. data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +2 -0
  100. data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +3 -3
  101. data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +9 -3
  102. data/lib/numbers_and_words/strategies/figures_converter/languages/pt.rb +2 -0
  103. data/lib/numbers_and_words/strategies/figures_converter/languages/ru.rb +2 -0
  104. data/lib/numbers_and_words/strategies/figures_converter/languages/se.rb +2 -0
  105. data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +2 -0
  106. data/lib/numbers_and_words/strategies/figures_converter/languages/ua.rb +2 -0
  107. data/lib/numbers_and_words/strategies/figures_converter/languages/vi.rb +4 -0
  108. data/lib/numbers_and_words/strategies/figures_converter/options.rb +14 -1
  109. data/lib/numbers_and_words/strategies/figures_converter/options/base.rb +5 -0
  110. data/lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb +30 -0
  111. data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +28 -0
  112. data/lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb +30 -0
  113. data/lib/numbers_and_words/strategies/figures_converter/options/cs.rb +2 -0
  114. data/lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb +3 -14
  115. data/lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb +3 -15
  116. data/lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb +3 -17
  117. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb +2 -0
  118. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb +2 -0
  119. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb +2 -0
  120. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/pronounced.rb +2 -0
  121. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_hyphen.rb +2 -0
  122. data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_zero.rb +2 -0
  123. data/lib/numbers_and_words/strategies/figures_converter/options/en.rb +2 -0
  124. data/lib/numbers_and_words/strategies/figures_converter/options/en/hundreds_with_union.rb +2 -0
  125. data/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +4 -11
  126. data/lib/numbers_and_words/strategies/figures_converter/options/en/pronounced.rb +6 -13
  127. data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_hyphen.rb +2 -0
  128. data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_zero.rb +3 -17
  129. data/lib/numbers_and_words/strategies/figures_converter/options/es.rb +2 -0
  130. data/lib/numbers_and_words/strategies/figures_converter/options/es/apocopated.rb +2 -0
  131. data/lib/numbers_and_words/strategies/figures_converter/options/es/gender.rb +3 -17
  132. data/lib/numbers_and_words/strategies/figures_converter/options/es/remove_zero.rb +3 -17
  133. data/lib/numbers_and_words/strategies/figures_converter/options/hu.rb +2 -0
  134. data/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb +3 -50
  135. data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR.rb +2 -0
  136. data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/gender.rb +3 -18
  137. data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/ordinal.rb +3 -15
  138. data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/remove_zero.rb +3 -17
  139. data/lib/numbers_and_words/strategies/figures_converter/options/ru.rb +2 -0
  140. data/lib/numbers_and_words/strategies/figures_converter/options/ru/gender.rb +3 -17
  141. data/lib/numbers_and_words/strategies/figures_converter/options/ua.rb +2 -0
  142. data/lib/numbers_and_words/strategies/figures_converter/options/ua/gender.rb +3 -17
  143. data/lib/numbers_and_words/translations.rb +3 -0
  144. data/lib/numbers_and_words/translations/base.rb +3 -1
  145. data/lib/numbers_and_words/translations/cs.rb +2 -0
  146. data/lib/numbers_and_words/translations/de.rb +2 -0
  147. data/lib/numbers_and_words/translations/en-GB.rb +2 -0
  148. data/lib/numbers_and_words/translations/en.rb +2 -0
  149. data/lib/numbers_and_words/translations/es.rb +10 -5
  150. data/lib/numbers_and_words/translations/et.rb +2 -0
  151. data/lib/numbers_and_words/translations/extensions/fraction_significance.rb +2 -0
  152. data/lib/numbers_and_words/translations/families/base.rb +2 -0
  153. data/lib/numbers_and_words/translations/families/cyrillic.rb +2 -0
  154. data/lib/numbers_and_words/translations/families/latin.rb +2 -0
  155. data/lib/numbers_and_words/translations/fr.rb +9 -7
  156. data/lib/numbers_and_words/translations/hu.rb +2 -0
  157. data/lib/numbers_and_words/translations/hy.rb +2 -0
  158. data/lib/numbers_and_words/translations/it.rb +2 -0
  159. data/lib/numbers_and_words/translations/ka.rb +3 -1
  160. data/lib/numbers_and_words/translations/kz.rb +9 -0
  161. data/lib/numbers_and_words/translations/lt.rb +2 -0
  162. data/lib/numbers_and_words/translations/lv.rb +2 -0
  163. data/lib/numbers_and_words/translations/nl.rb +3 -0
  164. data/lib/numbers_and_words/translations/pt-BR.rb +9 -2
  165. data/lib/numbers_and_words/translations/pt.rb +3 -0
  166. data/lib/numbers_and_words/translations/ru.rb +2 -0
  167. data/lib/numbers_and_words/translations/se.rb +2 -0
  168. data/lib/numbers_and_words/translations/tr.rb +2 -0
  169. data/lib/numbers_and_words/translations/ua.rb +2 -0
  170. data/lib/numbers_and_words/translations/vi.rb +5 -2
  171. data/lib/numbers_and_words/version.rb +3 -1
  172. data/lib/numbers_and_words/wrappers.rb +2 -0
  173. data/lib/numbers_and_words/wrappers/float.rb +3 -1
  174. data/lib/numbers_and_words/wrappers/integer.rb +2 -0
  175. metadata +28 -22
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c601603640f2fd42a075ea704686dd34fedcaac6
4
- data.tar.gz: 8f39dec70454ee3ee56416a686d5465b91191631
2
+ SHA256:
3
+ metadata.gz: 04032d6938d0487167512413e0035cfd44e568ad622c20fc304d80a217556cf9
4
+ data.tar.gz: c316187430a6d4930978215f478f34d9973fbe2bf0efa50dd3969652375eab51
5
5
  SHA512:
6
- metadata.gz: f3674f9549f9eabbe6611df88d22bebc05ef47506d627c6305fdfac36d79fd63b17fc8df711b61db6091a17a14d07fc48f2f80423fe59668ea2738beff8eb26a
7
- data.tar.gz: 8b09e7b44a277d9213d0d9edc408b750e7a5e904e8cc9f779808862f8fb08b075d29b2e7127e18921e8c6be042bf19f7bc69c9b30b5367ac414d33dd8f80983f
6
+ metadata.gz: 81f843d717a8b84cb29096e43845201ac5a2a95e63177736df9135520f452badcc01057035500afd65bed7df9bf36cf78a6ad94a5168295e3d43b2597b6d746b
7
+ data.tar.gz: 64dc18b49df49650052b3bc2ca1ad895ddbacd4e60cffe7614c76712bd0270a8eb3695e571fe8c31b4fdf801148bf183056a76a1124f831f6b973e5a231bcc15
@@ -1,12 +1,11 @@
1
1
  == numbers_and_words
2
2
 
3
3
  {<img src="https://badge.fury.io/rb/numbers_and_words.svg?branch=master" alt="Gem Version" />}[http://badge.fury.io/rb/numbers_and_words]
4
- {<img src="https://gemnasium.com/kslazarev/numbers_and_words.svg?branch=master" alt="Dependency Status" />}[https://gemnasium.com/kslazarev/numbers_and_words]
5
4
  {<img src="https://codeclimate.com/github/kslazarev/numbers_and_words.svg?branch=master" />}[https://codeclimate.com/github/kslazarev/numbers_and_words]
6
5
  {<img src="https://secure.travis-ci.org/kslazarev/numbers_and_words.svg?branch=master" />}[http://travis-ci.org/kslazarev/numbers_and_words]
7
6
  {<img src="https://coveralls.io/repos/kslazarev/numbers_and_words/badge.svg?branch=master" alt="Coverage Status" />}[https://coveralls.io/r/kslazarev/numbers_and_words]
8
7
 
9
- Convert numbers to words using the I18n library.
8
+ Spell out numbers in several languages using the I18n gem.
10
9
 
11
10
  Перевод чисел в слова при помощи библиотеки I18n.
12
11
 
@@ -16,7 +15,9 @@ Számok betűvel írva az I18n könyvtár segítségével.
16
15
 
17
16
  I18n kütüphanesi ile sayıları yazıya çevirir.
18
17
 
19
- Converte números em letras utilizando a biblioteca I18n.
18
+ Soletra números em vários idiomas utilizando a biblioteca I18n.
19
+
20
+ Deletrea números en varios idiomas utilizando la gema I18n.
20
21
 
21
22
  == Supported Languages / Языки / Langues Supportées
22
23
 
@@ -40,11 +41,11 @@ Converte números em letras utilizando a biblioteca I18n.
40
41
  * Português [pt]
41
42
  * Português Brasileiro [pt-BR]
42
43
  * հայերեն (Armenian) [hy]
44
+ * Қазақша [kz]
43
45
 
44
46
  ** Experimental
45
47
 
46
48
  * {[en-AU], [en-CA], [en-IN], [en-US]}*** => [en]
47
- * {[es-419], [es-AR], [es-CL], [es-CO], [es-MX], [es-PE], [es-VE]}*** => [es]
48
49
  * {[fr-CA], [fr-CH]}*** => [fr]
49
50
  * {[de], [de-AT], [de-CH]}*** => [de]
50
51
  * {[it-CH]}*** => [it]
@@ -89,6 +90,9 @@ Converte números em letras utilizando a biblioteca I18n.
89
90
  I18n.with_locale(:hy) { 42.to_words }
90
91
  => "քառասուն երկու"
91
92
 
93
+ I18n.with_locale(:kz) { 42.to_words }
94
+ => "қырық екi"
95
+
92
96
  21.to_words
93
97
  => "twenty-one"
94
98
  => "veintiuno"
@@ -109,6 +113,7 @@ Converte números em letras utilizando a biblioteca I18n.
109
113
  => "vinte e um"
110
114
  => "hai mươi mốt"
111
115
  => "քսան մեկ"
116
+ => "жиырма бiр"
112
117
 
113
118
  231.to_words
114
119
  => "two hundred thirty-one"
@@ -130,6 +135,7 @@ Converte números em letras utilizando a biblioteca I18n.
130
135
  => "duzentos e trinta e um"
131
136
  => "hai trăm ba mươi mốt"
132
137
  => "երկու հարյուր երեսուն մեկ"
138
+ => "екi жүз отыз бiр"
133
139
 
134
140
  4030.to_words
135
141
  => "four thousand thirty"
@@ -150,6 +156,7 @@ Converte números em letras utilizando a biblioteca I18n.
150
156
  => "čtyři tisíce třicet"
151
157
  => "bốn nghìn không trăm ba mươi"
152
158
  => "չորս հազար երեսուն"
159
+ => "төрт мың отыз"
153
160
 
154
161
  1000100.to_words
155
162
  => "one million one hundred"
@@ -170,6 +177,7 @@ Converte números em letras utilizando a biblioteca I18n.
170
177
  => "jeden milión jedno sto"
171
178
  => "một triệu một trăm"
172
179
  => "մեկ միլիոն հարյուր"
180
+ => "бiр миллион бiр жүз"
173
181
 
174
182
  1000000000000000000000000000000000.to_words
175
183
  => "one decillion"
@@ -187,6 +195,7 @@ Converte números em letras utilizando a biblioteca I18n.
187
195
  => "één decillion"
188
196
  => "en decillion"
189
197
  => "decilijon"
198
+ => "бiр дециллион"
190
199
 
191
200
  [1, 2, 3].to_words
192
201
  => ["one", "two", "three"]
@@ -201,6 +210,7 @@ Converte números em letras utilizando a biblioteca I18n.
201
210
  => ["jedna", "dva", "tři"]
202
211
  => ["một", "hai", "ba"]
203
212
  => ["մեկ", "երկու", "երեք"]
213
+ => ["бiр", "екi", "үш"]
204
214
 
205
215
  [11, 22, 133].to_words
206
216
  => ["eleven", "twenty-two", "one hundred thirty-three"]
@@ -221,6 +231,7 @@ Converte números em letras utilizando a biblioteca I18n.
221
231
  => ["jedenáct", "dvacetdva", "jedno sto třicettři"]
222
232
  => ["mười một", "hai mươi hai", "một trăm ba mươi ba"]
223
233
  => ["տասնմեկ", "քսան երկու", "հարյուր երեսուն երեք"]
234
+ => ["он бiр", "жиырма екi", "бiр жүз отыз үш"]
224
235
 
225
236
  21.77.to_words
226
237
  => "twenty-one and seventy-seven hundredths"
@@ -280,7 +291,7 @@ Converte números em letras utilizando a biblioteca I18n.
280
291
 
281
292
  * Brazilian Portuguese
282
293
 
283
- Change gender form: (gender: [:female || :male || :neuter])
294
+ Change gender form: (gender: [:female || :male])
284
295
 
285
296
  I18n.with_locale(:'pt-BR') { 1000000001.to_words gender: :female }
286
297
  => "um bilhão e uma"
@@ -298,7 +309,6 @@ Converte números em letras utilizando a biblioteca I18n.
298
309
  I18n.with_locale(:'cs') { 1.to_words gender: :neuter }
299
310
  => "jedno"
300
311
 
301
-
302
312
  Remove 'zero' from integral part of float: (remove_zero: [true || false])
303
313
 
304
314
  I18n.with_locale(:cs) { 0.7.to_words }
@@ -315,19 +325,49 @@ Converte números em letras utilizando a biblioteca I18n.
315
325
  I18n.with_locale(:cs) { 21.to_words gender: :female, ordinal: true }
316
326
  => "dvacátá první"
317
327
 
328
+ * Spanish
329
+
330
+ Change gender form: (gender: [:female || :male])
331
+
332
+ I18n.with_locale(:es) { 1.to_words gender: :female }
333
+ => "una"
334
+
335
+ I18n.with_locale(:es) { 1.to_words gender: :male }
336
+ => "uno"
337
+
338
+ Use the apocopated (shortened) form: (apocopated: [true || false])
339
+
340
+ I18n.with_locale(:es) { 1.to_words apocopated: true }
341
+ => "un"
342
+
343
+ Mix gender and apocopated forms:
344
+
345
+ I18n.with_locale(:es) { 201.to_words gender: :female, apocopated: true }
346
+ => "doscientas un"
347
+
348
+ Remove 'zero' from integral part of float: (remove_zero: [true || false])
349
+
350
+ I18n.with_locale(:es) { 0.7.to_words }
351
+ => "cero con siete décimas"
352
+
353
+ I18n.with_locale(:es) { 0.7.to_words remove_zero: true }
354
+ => "siete décimas"
355
+
318
356
  == Other options / Другие опции
319
357
 
320
- * precision
358
+ * Precision
321
359
 
322
360
  You may pass argument :precision that added zeros to the end of float number:
323
361
 
324
362
  I18n.with_locale(:ru) { 0.1.to_words precision: 3 }
325
363
  => ноль целых и десять сотых
326
364
 
365
+ I18n.with_locale(:es) { 0.2.to_words precision: 2 }
366
+ => cero con veinte centésimas
367
+
327
368
  == Requirements / Требования / Configuration Requise
328
369
 
329
- * 1.9.3 <= Ruby (compatible with/совместимость с/compatible avec Ruby 1.9, JRuby and/и/et Rubinius);
330
- * 1.8.7 <= Ruby <= 1.9.2 (-v 0.9.0)
370
+ * 2.5 <= Ruby (compatible with/совместимость с/compatible avec Ruby 2.5 and/и/et JRuby);
331
371
  * 0.5.0 <= I18n (earlier versions not tested/ранние версии не тестировались/versions précédentes non testées);
332
372
 
333
373
  == Installation / Установка / Installation
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rubygems'
2
4
  require 'i18n'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/core_ext/integer'
2
4
  require 'numbers_and_words/core_ext/float'
3
5
  require 'numbers_and_words/core_ext/array'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Array
2
4
  def to_words(options = {})
3
5
  map { |element| element.to_words options }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Float
2
4
  def to_words(options = {})
3
5
  NumbersAndWords::Wrappers::Float.new(self).to_words options
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Integer
2
4
  def to_words(options = {})
3
5
  NumbersAndWords::Wrappers::Integer.new(self).to_words options
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/helper_classes/figures_array'
2
4
  require 'numbers_and_words/helper_classes/words_array'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module ArrayExtensions
3
5
  module Helpers
@@ -37,7 +39,7 @@ module NumbersAndWords
37
39
  end
38
40
 
39
41
  def ones
40
- self[0].to_i if self[0].to_i > 0
42
+ self[0].to_i if self[0].to_i.positive?
41
43
  end
42
44
 
43
45
  def teens
@@ -45,7 +47,7 @@ module NumbersAndWords
45
47
  end
46
48
 
47
49
  def tens
48
- self[1].to_i if self[1] && self[1].to_i > 0
50
+ self[1].to_i if self[1].to_i.positive?
49
51
  end
50
52
 
51
53
  def tens_with_ones
@@ -53,7 +55,7 @@ module NumbersAndWords
53
55
  end
54
56
 
55
57
  def hundreds
56
- self[2].to_i if self[2].to_i > 0
58
+ self[2].to_i if self[2].to_i.positive?
57
59
  end
58
60
 
59
61
  def round_hundred?
@@ -77,7 +79,7 @@ module NumbersAndWords
77
79
  end
78
80
 
79
81
  def ordinal_index
80
- index { |figure| figure != 0 }
82
+ index(&:positive?)
81
83
  end
82
84
 
83
85
  def ordinal_capacity
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/helper_classes/array_extensions/helpers'
2
4
 
3
5
  module NumbersAndWords
@@ -12,8 +14,12 @@ module NumbersAndWords
12
14
  super.to_figures
13
15
  end
14
16
 
15
- def local_language
16
- ::I18n.with_locale(I18n.local_language) { yield }
17
+ def figures_array_in_capacity(capacity)
18
+ super.to_figures
19
+ end
20
+
21
+ def local_language(&block)
22
+ ::I18n.with_locale(I18n.local_language, &block)
17
23
  end
18
24
  end
19
25
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/helper_classes/array_extensions/helpers'
2
4
 
3
5
  module NumbersAndWords
@@ -6,8 +8,8 @@ module NumbersAndWords
6
8
  local_language { Strategies.array_joiner.new(to_a, options).run }
7
9
  end
8
10
 
9
- def local_language
10
- ::I18n.with_locale(I18n.local_language) { yield }
11
+ def local_language(&block)
12
+ ::I18n.with_locale(I18n.local_language, &block)
11
13
  end
12
14
  end
13
15
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/i18n/pluralization'
2
4
  require 'numbers_and_words/i18n/initialization'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module I18n
3
5
  module Initialization
@@ -0,0 +1,7 @@
1
+ kz:
2
+ numbers:
3
+ ones: [нөл, бiр, екi, үш, төрт, бес, алты, жетi, сегiз, тоғыз]
4
+ teens: [_, он бiр, он екi, он үш, он төрт, он бес, он алты, он жетi, он сегiз, он тоғыз]
5
+ tens: [_, он, жиырма, отыз, қырық, елу, алпыс, жетпiс, сексен, тоқсан]
6
+ hundreds: жүз
7
+ mega: [_, мың, миллион, миллиард, триллион, квадриллион, квинтиллион, секстиллион, септиллион, октиллион, нониллион, дециллион]
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/i18n/plurals/cs'
2
4
  require 'numbers_and_words/i18n/plurals/ru'
3
5
  require 'numbers_and_words/i18n/plurals/ua'
@@ -12,7 +14,7 @@ module NumbersAndWords
12
14
 
13
15
  def init
14
16
  ::I18n.load_path << config_file
15
- ::I18n::Backend::Simple.send :include, ::I18n::Backend::Pluralization
17
+ ::I18n::Backend::Simple.include ::I18n::Backend::Pluralization
16
18
  end
17
19
 
18
20
  def files
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module I18n
3
5
  module Plurals
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module I18n
3
5
  module Plurals
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module I18n
3
5
  module Plurals
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module I18n
3
5
  module Plurals
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Hash[
2
4
  NumbersAndWords::I18n::Pluralization.languages.map do |language|
3
5
  [language.to_sym, {
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module I18n
3
5
  module Plurals
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module I18n
3
5
  module Plurals
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/strategies/figures_converter'
2
4
  require 'numbers_and_words/strategies/array_joiner'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/strategies/array_joiner/languages'
2
4
 
3
5
  module NumbersAndWords
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'numbers_and_words/strategies/array_joiner/languages/families/base'
2
4
 
3
5
  require 'numbers_and_words/strategies/array_joiner/languages/base'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Strategies
3
5
  module ArrayJoiner
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Strategies
3
5
  module ArrayJoiner
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Strategies
3
5
  module ArrayJoiner
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Strategies
3
5
  module ArrayJoiner
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Strategies
3
5
  module ArrayJoiner
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module NumbersAndWords
2
4
  module Strategies
3
5
  module ArrayJoiner