numbers_and_words 0.11.3 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +10 -0
- data/lib/numbers_and_words/i18n/locales/numbers.hy.yml +7 -0
- data/lib/numbers_and_words/i18n/plurals/cs.rb +13 -10
- data/lib/numbers_and_words/i18n/plurals/fr.rb +3 -3
- data/lib/numbers_and_words/i18n/plurals/lt.rb +8 -7
- data/lib/numbers_and_words/i18n/plurals/lv.rb +3 -3
- data/lib/numbers_and_words/i18n/plurals/ru.rb +13 -10
- data/lib/numbers_and_words/strategies/figures_converter/languages.rb +1 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/hy.rb +27 -0
- data/lib/numbers_and_words/strategies/figures_converter/languages/ka.rb +1 -3
- data/lib/numbers_and_words/strategies/figures_converter/languages/pt-BR.rb +4 -6
- data/lib/numbers_and_words/strategies/figures_converter/options.rb +1 -1
- data/lib/numbers_and_words/translations.rb +1 -0
- data/lib/numbers_and_words/translations/hy.rb +19 -0
- data/lib/numbers_and_words/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f6672607ef61331dcab2560613f0983f852e521
|
4
|
+
data.tar.gz: caff72eea42948c2e55ecec50061eec8a9dfba34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d762972288f8b5213c880eab4d2d13bf2183f017e4955d5edc5373923e6aaf1e9e1685232e981fd4e0725151cd13d90dd314d04986e15e6d8516fd3d82981f2
|
7
|
+
data.tar.gz: f6e50fc911f8e55db858e17bcd653bfdfbc99952fa5f2965e80efff59c0b949dca1992389c802c881d2e702e138f2072c34101c1958fbb7e9ac8c86f06cef43f
|
data/README.rdoc
CHANGED
@@ -39,6 +39,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
39
39
|
* Česky [cs]
|
40
40
|
* Português [pt]
|
41
41
|
* Português Brasileiro [pt-BR]
|
42
|
+
* հայերեն (Armenian) [hy]
|
42
43
|
|
43
44
|
** Experimental
|
44
45
|
|
@@ -85,6 +86,9 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
85
86
|
I18n.with_locale(:vi) { 42.to_words }
|
86
87
|
=> "bốn mươi hai"
|
87
88
|
|
89
|
+
I18n.with_locale(:hy) { 42.to_words }
|
90
|
+
=> "քառասուն երկու"
|
91
|
+
|
88
92
|
21.to_words
|
89
93
|
=> "twenty-one"
|
90
94
|
=> "veintiuno"
|
@@ -104,6 +108,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
104
108
|
=> "dvacetjedna"
|
105
109
|
=> "vinte e um"
|
106
110
|
=> "hai mươi mốt"
|
111
|
+
=> "քսան մեկ"
|
107
112
|
|
108
113
|
231.to_words
|
109
114
|
=> "two hundred thirty-one"
|
@@ -124,6 +129,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
124
129
|
=> "dvě stě třicetjedna"
|
125
130
|
=> "duzentos e trinta e um"
|
126
131
|
=> "hai trăm ba mươi mốt"
|
132
|
+
=> "երկու հարյուր երեսուն մեկ"
|
127
133
|
|
128
134
|
4030.to_words
|
129
135
|
=> "four thousand thirty"
|
@@ -143,6 +149,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
143
149
|
=> "fyra tusen trettio"
|
144
150
|
=> "čtyři tisíce třicet"
|
145
151
|
=> "bốn nghìn không trăm ba mươi"
|
152
|
+
=> "չորս հազար երեսուն"
|
146
153
|
|
147
154
|
1000100.to_words
|
148
155
|
=> "one million one hundred"
|
@@ -162,6 +169,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
162
169
|
=> "en miljoner en hundra"
|
163
170
|
=> "jeden milión jedno sto"
|
164
171
|
=> "một triệu một trăm"
|
172
|
+
=> "միլիոն հարյուր"
|
165
173
|
|
166
174
|
1000000000000000000000000000000000.to_words
|
167
175
|
=> "one decillion"
|
@@ -192,6 +200,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
192
200
|
=> ["ერთი", "ორი", "სამი"]
|
193
201
|
=> ["jedna", "dva", "tři"]
|
194
202
|
=> ["một", "hai", "ba"]
|
203
|
+
=> ["մեկ", "երկու", "երեք"]
|
195
204
|
|
196
205
|
[11, 22, 133].to_words
|
197
206
|
=> ["eleven", "twenty-two", "one hundred thirty-three"]
|
@@ -211,6 +220,7 @@ Converte números em letras utilizando a biblioteca I18n.
|
|
211
220
|
=> ["elva", "tjugo-två", "en hundra trettio-tre"]
|
212
221
|
=> ["jedenáct", "dvacetdva", "jedno sto třicettři"]
|
213
222
|
=> ["mười một", "hai mươi hai", "một trăm ba mươi ba"]
|
223
|
+
=> ["տասնմեկ", "քսան երկու", "հարյուր երեսուն երեք"]
|
214
224
|
|
215
225
|
21.77.to_words
|
216
226
|
=> "twenty-one and seventy-seven hundredths"
|
@@ -0,0 +1,7 @@
|
|
1
|
+
hy:
|
2
|
+
numbers:
|
3
|
+
ones: [զրո, մեկ, երկու, երեք, չորս, հինգ, վեց, յոթ, ութ, ինը]
|
4
|
+
teens: [_, տասնմեկ, տասներկու, տասներեք, տասնչորս, տասնհինգ, տասնվեց, տասնյոթ, տասնութ, տասնինը]
|
5
|
+
tens: [_, տասը, քսան, երեսուն, քառասուն, հիսուն, վաթսուն, յոթանասուն, ութսուն, իննսուն]
|
6
|
+
hundreds: հարյուր
|
7
|
+
mega: [_, հազար, միլիոն, միլիարդ, տրիլիոն, քառակուսի]
|
@@ -4,28 +4,31 @@ module NumbersAndWords
|
|
4
4
|
module Cs
|
5
5
|
module_function
|
6
6
|
|
7
|
-
RULE = lambda do |
|
8
|
-
if one_conditions(
|
7
|
+
RULE = lambda do |number|
|
8
|
+
if one_conditions(number)
|
9
9
|
:one
|
10
|
-
elsif few_conditions(
|
10
|
+
elsif few_conditions(number)
|
11
11
|
:few
|
12
|
-
elsif many_conditions(
|
12
|
+
elsif many_conditions(number)
|
13
13
|
:many
|
14
14
|
else
|
15
15
|
:other
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def one_conditions(
|
20
|
-
|
19
|
+
def one_conditions(number)
|
20
|
+
number % 10 == 1 && number % 100 != 11
|
21
21
|
end
|
22
22
|
|
23
|
-
def few_conditions(
|
24
|
-
[2, 3, 4].include?(
|
23
|
+
def few_conditions(number)
|
24
|
+
[2, 3, 4].include?(number % 10) &&
|
25
|
+
![12, 13, 14].include?(number % 100)
|
25
26
|
end
|
26
27
|
|
27
|
-
def many_conditions(
|
28
|
-
(
|
28
|
+
def many_conditions(number)
|
29
|
+
(number % 10).zero? ||
|
30
|
+
[5, 6, 7, 8, 9].include?(number % 10) ||
|
31
|
+
[11, 12, 13, 14].include?(number % 100)
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
@@ -4,10 +4,10 @@ module NumbersAndWords
|
|
4
4
|
module Fr
|
5
5
|
module_function
|
6
6
|
|
7
|
-
RULE = ->(
|
7
|
+
RULE = ->(number) { one_conditions(number) ? :one : :other }
|
8
8
|
|
9
|
-
def one_conditions(
|
10
|
-
|
9
|
+
def one_conditions(number)
|
10
|
+
number % 10 == 1 && number % 100 != 11
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -4,22 +4,23 @@ module NumbersAndWords
|
|
4
4
|
module Lt
|
5
5
|
module_function
|
6
6
|
|
7
|
-
RULE = lambda do |
|
8
|
-
if one_conditions(
|
7
|
+
RULE = lambda do |number|
|
8
|
+
if one_conditions(number)
|
9
9
|
:one
|
10
|
-
elsif ones_conditions(
|
10
|
+
elsif ones_conditions(number)
|
11
11
|
:ones
|
12
12
|
else
|
13
13
|
:other
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def one_conditions(
|
18
|
-
|
17
|
+
def one_conditions(number)
|
18
|
+
number % 10 == 1 && number % 100 != 11
|
19
19
|
end
|
20
20
|
|
21
|
-
def ones_conditions(
|
22
|
-
[2, 3, 4, 5, 6, 7, 8, 9].include?(
|
21
|
+
def ones_conditions(number)
|
22
|
+
[2, 3, 4, 5, 6, 7, 8, 9].include?(number % 10) &&
|
23
|
+
![12, 13, 14, 15, 16, 17, 18, 19].include?(number % 100)
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -4,10 +4,10 @@ module NumbersAndWords
|
|
4
4
|
module Lv
|
5
5
|
module_function
|
6
6
|
|
7
|
-
RULE = ->(
|
7
|
+
RULE = ->(number) { one_conditions(number) ? :one : :other }
|
8
8
|
|
9
|
-
def one_conditions(
|
10
|
-
|
9
|
+
def one_conditions(number)
|
10
|
+
number % 10 == 1 && number % 100 != 11
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -4,28 +4,31 @@ module NumbersAndWords
|
|
4
4
|
module Ru
|
5
5
|
module_function
|
6
6
|
|
7
|
-
RULE = lambda do |
|
8
|
-
if one_conditions(
|
7
|
+
RULE = lambda do |number|
|
8
|
+
if one_conditions(number)
|
9
9
|
:one
|
10
|
-
elsif few_conditions(
|
10
|
+
elsif few_conditions(number)
|
11
11
|
:few
|
12
|
-
elsif many_conditions(
|
12
|
+
elsif many_conditions(number)
|
13
13
|
:many
|
14
14
|
else
|
15
15
|
:other
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def one_conditions(
|
20
|
-
|
19
|
+
def one_conditions(number)
|
20
|
+
number % 10 == 1 && number % 100 != 11
|
21
21
|
end
|
22
22
|
|
23
|
-
def few_conditions(
|
24
|
-
[2, 3, 4].include?(
|
23
|
+
def few_conditions(number)
|
24
|
+
[2, 3, 4].include?(number % 10) &&
|
25
|
+
![12, 13, 14].include?(number % 100)
|
25
26
|
end
|
26
27
|
|
27
|
-
def many_conditions(
|
28
|
-
(
|
28
|
+
def many_conditions(number)
|
29
|
+
(number % 10).zero? ||
|
30
|
+
[5, 6, 7, 8, 9].include?(number % 10) ||
|
31
|
+
[11, 12, 13, 14].include?(number % 100)
|
29
32
|
end
|
30
33
|
end
|
31
34
|
end
|
@@ -19,6 +19,7 @@ require 'numbers_and_words/strategies/figures_converter/languages/pt-BR'
|
|
19
19
|
require 'numbers_and_words/strategies/figures_converter/languages/pt'
|
20
20
|
require 'numbers_and_words/strategies/figures_converter/languages/se'
|
21
21
|
require 'numbers_and_words/strategies/figures_converter/languages/tr'
|
22
|
+
require 'numbers_and_words/strategies/figures_converter/languages/hy'
|
22
23
|
|
23
24
|
require 'numbers_and_words/strategies/figures_converter/languages/families/cyrillic'
|
24
25
|
require 'numbers_and_words/strategies/figures_converter/languages/ru'
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module NumbersAndWords
|
2
|
+
module Strategies
|
3
|
+
module FiguresConverter
|
4
|
+
module Languages
|
5
|
+
class Hy < Base
|
6
|
+
def capacity_iteration
|
7
|
+
words = []
|
8
|
+
capacity_words = words_in_capacity(@current_capacity)
|
9
|
+
words.push(megs) unless capacity_words.empty?
|
10
|
+
words += capacity_words unless thousand? && one?
|
11
|
+
words
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def one?
|
17
|
+
words_in_capacity(@current_capacity) == [translations.ones(1)]
|
18
|
+
end
|
19
|
+
|
20
|
+
def thousand?
|
21
|
+
FiguresArray::THOUSAND_CAPACITY <= @current_capacity
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -82,12 +82,10 @@ module NumbersAndWords
|
|
82
82
|
|
83
83
|
def without_connector?
|
84
84
|
return false if with_comma?
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
# without connector when there is hundreds and ones
|
90
|
-
return true if figures.hundreds && figures.ones
|
85
|
+
return true if figures.hundreds &&
|
86
|
+
(figures.tens_with_ones ||
|
87
|
+
figures.tens ||
|
88
|
+
figures.ones)
|
91
89
|
false
|
92
90
|
end
|
93
91
|
|
@@ -23,6 +23,7 @@ require 'numbers_and_words/translations/pt-BR'
|
|
23
23
|
require 'numbers_and_words/translations/ka'
|
24
24
|
require 'numbers_and_words/translations/cs'
|
25
25
|
require 'numbers_and_words/translations/vi'
|
26
|
+
require 'numbers_and_words/translations/hy'
|
26
27
|
|
27
28
|
module NumbersAndWords
|
28
29
|
module Translations
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module NumbersAndWords
|
2
|
+
module Translations
|
3
|
+
class Hy < Base
|
4
|
+
include NumbersAndWords::Translations::Families::Latin
|
5
|
+
|
6
|
+
def tens_with_ones(numbers, options = {})
|
7
|
+
options[:separator] ||= ''
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def hundreds(number, _options = {})
|
12
|
+
parts = [t(:hundreds)]
|
13
|
+
parts.unshift(t(:ones)[number]) if number > 1
|
14
|
+
|
15
|
+
parts.join(' ')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: numbers_and_words
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kirill Lazarev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -81,6 +81,7 @@ files:
|
|
81
81
|
- lib/numbers_and_words/i18n/locales/numbers.et.yml
|
82
82
|
- lib/numbers_and_words/i18n/locales/numbers.fr.yml
|
83
83
|
- lib/numbers_and_words/i18n/locales/numbers.hu.yml
|
84
|
+
- lib/numbers_and_words/i18n/locales/numbers.hy.yml
|
84
85
|
- lib/numbers_and_words/i18n/locales/numbers.it.yml
|
85
86
|
- lib/numbers_and_words/i18n/locales/numbers.ka.yml
|
86
87
|
- lib/numbers_and_words/i18n/locales/numbers.lt.yml
|
@@ -172,6 +173,7 @@ files:
|
|
172
173
|
- lib/numbers_and_words/strategies/figures_converter/languages/families/helpers.rb
|
173
174
|
- lib/numbers_and_words/strategies/figures_converter/languages/fr.rb
|
174
175
|
- lib/numbers_and_words/strategies/figures_converter/languages/hu.rb
|
176
|
+
- lib/numbers_and_words/strategies/figures_converter/languages/hy.rb
|
175
177
|
- lib/numbers_and_words/strategies/figures_converter/languages/it.rb
|
176
178
|
- lib/numbers_and_words/strategies/figures_converter/languages/ka.rb
|
177
179
|
- lib/numbers_and_words/strategies/figures_converter/languages/lt.rb
|
@@ -229,6 +231,7 @@ files:
|
|
229
231
|
- lib/numbers_and_words/translations/families/latin.rb
|
230
232
|
- lib/numbers_and_words/translations/fr.rb
|
231
233
|
- lib/numbers_and_words/translations/hu.rb
|
234
|
+
- lib/numbers_and_words/translations/hy.rb
|
232
235
|
- lib/numbers_and_words/translations/it.rb
|
233
236
|
- lib/numbers_and_words/translations/ka.rb
|
234
237
|
- lib/numbers_and_words/translations/lt.rb
|
@@ -265,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
268
|
version: '0'
|
266
269
|
requirements: []
|
267
270
|
rubyforge_project:
|
268
|
-
rubygems_version: 2.6.
|
271
|
+
rubygems_version: 2.6.14
|
269
272
|
signing_key:
|
270
273
|
specification_version: 4
|
271
274
|
summary: Convert numbers to words using I18N.
|