numbers_and_words 0.11.4 → 0.11.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.rdoc +50 -10
- data/lib/numbers_and_words.rb +2 -0
- data/lib/numbers_and_words/core_ext.rb +2 -0
- data/lib/numbers_and_words/core_ext/array.rb +2 -0
- data/lib/numbers_and_words/core_ext/float.rb +2 -0
- data/lib/numbers_and_words/core_ext/integer.rb +2 -0
- data/lib/numbers_and_words/helper_classes.rb +2 -0
- data/lib/numbers_and_words/helper_classes/array_extensions/helpers.rb +6 -4
- data/lib/numbers_and_words/helper_classes/figures_array.rb +5 -3
- data/lib/numbers_and_words/helper_classes/words_array.rb +4 -2
- data/lib/numbers_and_words/i18n.rb +2 -0
- data/lib/numbers_and_words/i18n/initialization.rb +2 -0
- data/lib/numbers_and_words/i18n/locales/numbers.kz.yml +7 -0
- data/lib/numbers_and_words/i18n/pluralization.rb +3 -1
- data/lib/numbers_and_words/i18n/plurals/cs.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/fr.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/lt.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/lv.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/plurals.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/ru.rb +2 -0
- data/lib/numbers_and_words/i18n/plurals/ua.rb +2 -0
- data/lib/numbers_and_words/strategies.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/base.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/en.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/es.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/families/base.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/array_joiner/languages/vi.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter.rb +4 -2
- data/lib/numbers_and_words/strategies/figures_converter/decorators.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/cs/integral.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en-GB/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/en/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/fractional.rb +3 -1
- data/lib/numbers_and_words/strategies/figures_converter/decorators/es/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/fr/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/hu/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/pt-BR/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ru/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/ua/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/fractional.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/decorators/vi/integral.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages.rb +3 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/de.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/en.rb +3 -7
- data/lib/numbers_and_words/strategies/figures_converter/languages/es.rb +11 -11
- data/lib/numbers_and_words/strategies/figures_converter/languages/et.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/base.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/cyrillic.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/fr.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/hy.rb +2 -17
- data/lib/numbers_and_words/strategies/figures_converter/languages/it.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/kz.rb +12 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/lt.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/lv.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/nl.rb +3 -3
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +9 -3
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/se.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/tr.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/vi.rb +4 -0
- data/lib/numbers_and_words/strategies/figures_converter/options.rb +14 -1
- data/lib/numbers_and_words/strategies/figures_converter/options/base.rb +5 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/gender.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/ordinal.rb +28 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/base/remove_zero.rb +30 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/cs.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/gender.rb +3 -14
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/ordinal.rb +3 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/cs/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/hundreds_with_union.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/ordinal.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/pronounced.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_hyphen.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en-GB/remove_zero.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/hundreds_with_union.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/ordinal.rb +4 -11
- data/lib/numbers_and_words/strategies/figures_converter/options/en/pronounced.rb +6 -13
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_hyphen.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/en/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/es.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/es/apocopated.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/es/gender.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/es/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/hu.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/hu/ordinal.rb +3 -50
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/gender.rb +3 -18
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/ordinal.rb +3 -15
- data/lib/numbers_and_words/strategies/figures_converter/options/pt-BR/remove_zero.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ru.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/ru/gender.rb +3 -17
- data/lib/numbers_and_words/strategies/figures_converter/options/ua.rb +2 -0
- data/lib/numbers_and_words/strategies/figures_converter/options/ua/gender.rb +3 -17
- data/lib/numbers_and_words/translations.rb +3 -0
- data/lib/numbers_and_words/translations/base.rb +3 -1
- data/lib/numbers_and_words/translations/cs.rb +2 -0
- data/lib/numbers_and_words/translations/de.rb +2 -0
- data/lib/numbers_and_words/translations/en-GB.rb +2 -0
- data/lib/numbers_and_words/translations/en.rb +2 -0
- data/lib/numbers_and_words/translations/es.rb +10 -5
- data/lib/numbers_and_words/translations/et.rb +2 -0
- data/lib/numbers_and_words/translations/extensions/fraction_significance.rb +2 -0
- data/lib/numbers_and_words/translations/families/base.rb +2 -0
- data/lib/numbers_and_words/translations/families/cyrillic.rb +2 -0
- data/lib/numbers_and_words/translations/families/latin.rb +2 -0
- data/lib/numbers_and_words/translations/fr.rb +9 -7
- data/lib/numbers_and_words/translations/hu.rb +2 -0
- data/lib/numbers_and_words/translations/hy.rb +2 -0
- data/lib/numbers_and_words/translations/it.rb +2 -0
- data/lib/numbers_and_words/translations/ka.rb +3 -1
- data/lib/numbers_and_words/translations/kz.rb +9 -0
- data/lib/numbers_and_words/translations/lt.rb +2 -0
- data/lib/numbers_and_words/translations/lv.rb +2 -0
- data/lib/numbers_and_words/translations/nl.rb +3 -0
- data/lib/numbers_and_words/translations/pt-BR.rb +9 -2
- data/lib/numbers_and_words/translations/pt.rb +3 -0
- data/lib/numbers_and_words/translations/ru.rb +2 -0
- data/lib/numbers_and_words/translations/se.rb +2 -0
- data/lib/numbers_and_words/translations/tr.rb +2 -0
- data/lib/numbers_and_words/translations/ua.rb +2 -0
- data/lib/numbers_and_words/translations/vi.rb +5 -2
- data/lib/numbers_and_words/version.rb +3 -1
- data/lib/numbers_and_words/wrappers.rb +2 -0
- data/lib/numbers_and_words/wrappers/float.rb +3 -1
- data/lib/numbers_and_words/wrappers/integer.rb +2 -0
- metadata +28 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a565a7b412e3ce37990ada8ada522f55e08db8d24576dcab13afee2f70b3a5c7
|
4
|
+
data.tar.gz: 076ba08de6db6213ee609389da12aa956456963df17906fd1b8175c39edc4f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 749dc5a65e4d482918cdc7a72f5c66436e5e26bce3c9ec217e8b57e1dd9f2364282ef673b05b4be4464a58ffe7a561b719fbd2b46c5d5e3b54979629044b0234
|
7
|
+
data.tar.gz: eadf0605cd88d2e97bafdf6dea1ad1f8e1333d9a8b127bf906431ec53096a9f52cfaa14afb8ac33dc98b97fc283b0953c944073b33e2a2ac9524d77ef66d881c
|
data/README.rdoc
CHANGED
@@ -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
|
-
|
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
|
-
|
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"
|
@@ -169,7 +176,8 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
169
176
|
=> "en miljoner en hundra"
|
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
|
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
|
-
*
|
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
|
-
*
|
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
|
data/lib/numbers_and_words.rb
CHANGED
@@ -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
|
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]
|
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
|
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
|
82
|
+
index(&:positive?)
|
81
83
|
end
|
82
84
|
|
83
85
|
def ordinal_capacity
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'numbers_and_words/helper_classes/array_extensions/helpers'
|
2
4
|
|
3
5
|
module NumbersAndWords
|
4
6
|
class FiguresArray < Array
|
5
|
-
include ArrayExtensions::Helpers
|
7
|
+
Array.include ArrayExtensions::Helpers
|
6
8
|
|
7
9
|
def to_words(options = {})
|
8
10
|
local_language { Strategies.figures_converter.new(self, options).run }
|
@@ -12,8 +14,8 @@ module NumbersAndWords
|
|
12
14
|
super.to_figures
|
13
15
|
end
|
14
16
|
|
15
|
-
def local_language
|
16
|
-
::I18n.with_locale(I18n.local_language)
|
17
|
+
def local_language(&block)
|
18
|
+
::I18n.with_locale(I18n.local_language, &block)
|
17
19
|
end
|
18
20
|
end
|
19
21
|
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)
|
11
|
+
def local_language(&block)
|
12
|
+
::I18n.with_locale(I18n.local_language, &block)
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -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.
|
17
|
+
::I18n::Backend::Simple.include ::I18n::Backend::Pluralization
|
16
18
|
end
|
17
19
|
|
18
20
|
def files
|