kabal 0.2.19 → 0.2.20
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ace3cb07e31a4f58cd9d996c21293268c3654e99
|
4
|
+
data.tar.gz: 5abaea18a9c86cf789a0b02c13640918afa9c557
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c01b9cdfb2d9b04a5f02fa9096226f572e364a5c69c0521239156ed165395fe768f31cc6ed6d8706f976f6af27dc8629fbd1f61e1431b509812d386ed59ce99a
|
7
|
+
data.tar.gz: e9e0f3c767d68aae8277d8f8ff65b678af4b0686f1a46d374f4ec8f68b8d6baf34f105b5bfafee18118c8f98dc93558eb074d48f4fe2e6545910e93472ae06fc
|
@@ -21,8 +21,8 @@ module Kabal
|
|
21
21
|
def three_words(number)
|
22
22
|
return two_words number if number <= 99
|
23
23
|
number_name = single(number / 100) + " " + names["ten_powers"][2]
|
24
|
-
number_name += " " + two_words(number % 100) if
|
25
|
-
number_name += " and " + single(number % 100) if
|
24
|
+
number_name += " " + two_words(number % 100) if number % 100 >= 10
|
25
|
+
number_name += " " + names["and"] + " " + single(number % 100) if number % 100 < 10 and number % 100 != 0
|
26
26
|
number_name
|
27
27
|
end
|
28
28
|
|
@@ -46,7 +46,8 @@ module Kabal
|
|
46
46
|
end
|
47
47
|
|
48
48
|
def less_thousands(number)
|
49
|
-
|
49
|
+
return if number == 0
|
50
|
+
@number_name += " " + names["and"] if number < 100
|
50
51
|
@number_name += " " + three_words(number % 1000) unless number == 0
|
51
52
|
end
|
52
53
|
end
|
data/lib/kabal/version.rb
CHANGED
@@ -13,6 +13,18 @@ class EnglishTest < TestCase
|
|
13
13
|
assert_equal "twenty one", @eng.convert(21)
|
14
14
|
end
|
15
15
|
|
16
|
+
def test_one_hundred
|
17
|
+
assert_equal "one hundred", @eng.convert(100)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_one_thousand
|
21
|
+
assert_equal "one thousand", @eng.convert(1000)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_one_million
|
25
|
+
assert_equal "one million", @eng.convert(1000000)
|
26
|
+
end
|
27
|
+
|
16
28
|
def test_three_words
|
17
29
|
assert_equal "one hundred twenty one", @eng.convert(121)
|
18
30
|
end
|
data/yaml/languages/en.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kabal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|