numbers_and_words 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/locales/plurals.rb
CHANGED
@@ -2,20 +2,13 @@ module NumbersAndWords
|
|
2
2
|
module Locales
|
3
3
|
module Plurals
|
4
4
|
|
5
|
-
RU = lambda do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
:few
|
13
|
-
else
|
14
|
-
:many
|
15
|
-
end
|
16
|
-
else
|
17
|
-
:other
|
18
|
-
end
|
5
|
+
RU = lambda do |n|
|
6
|
+
n % 10 == 1 && n % 100 != 11 ?
|
7
|
+
:one :
|
8
|
+
[2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ?
|
9
|
+
:few :
|
10
|
+
n % 10 == 0 || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) ?
|
11
|
+
:many : :other
|
19
12
|
end
|
20
13
|
|
21
14
|
EN = lambda { |count| 1 == count ? :one : :other }
|
@@ -16,12 +16,6 @@ module NumbersAndWords
|
|
16
16
|
figures_array_in_capacity(capacity).reverse.join.to_i
|
17
17
|
end
|
18
18
|
|
19
|
-
def number_for_gender capacity
|
20
|
-
figures = figures_array_in_capacity(capacity)
|
21
|
-
teens = figures.teens
|
22
|
-
teens ? teens.join.to_i : figures.first
|
23
|
-
end
|
24
|
-
|
25
19
|
def is_a_thousand_capacity? capacity
|
26
20
|
THOUSAND_CAPACITY == capacity
|
27
21
|
end
|
@@ -34,7 +34,7 @@ module NumbersAndWords
|
|
34
34
|
|
35
35
|
unless number_in_capacity_by_words.empty?
|
36
36
|
if 0 < capacity
|
37
|
-
words.push translation_megs(capacity, figures.
|
37
|
+
words.push translation_megs(capacity, figures.number_in_capacity(capacity))
|
38
38
|
end
|
39
39
|
words += number_in_capacity_by_words
|
40
40
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: numbers_and_words
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|