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: afe3367013925af32229e8c4a516552299b46385
4
- data.tar.gz: e50d47bb731812a5fd6ebf53446c74d8650f2378
3
+ metadata.gz: ace3cb07e31a4f58cd9d996c21293268c3654e99
4
+ data.tar.gz: 5abaea18a9c86cf789a0b02c13640918afa9c557
5
5
  SHA512:
6
- metadata.gz: 9f83ed35ae41c3cb18150189f534b4c257be37579b90520ae52bb34d56561a177ecab0169e340e2896782d5b71379d0af5853595c00f209ab4f8c872dcd18ba9
7
- data.tar.gz: dcab1c7d66dcb42c35f31c7a397a5163a42385d679e4ea5fed014e941a67d5b6ffc9141c59e55fa8644dca6d203747b90f464fa94e3d0ee52aeb51e4db1c9d8a
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 (number % 100 >= 10)
25
- number_name += " and " + single(number % 100) if (number % 100 < 10)
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
- @number_name += " and" if number < 100
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
@@ -1,3 +1,3 @@
1
1
  module Kabal
2
- VERSION = "0.2.19"
2
+ VERSION = "0.2.20"
3
3
  end
@@ -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
@@ -1,4 +1,5 @@
1
1
  en:
2
+ and: "and"
2
3
  minus: minus
3
4
  dot: point
4
5
  single:
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.19
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-25 00:00:00.000000000 Z
11
+ date: 2014-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler