kabal 0.2.9 → 0.2.10

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: 813ac39940e2a2c9b6da8b38d3c76730ae3bfeb6
4
- data.tar.gz: d623a344b9024a9794d3ad220daee550ff934028
3
+ metadata.gz: 5daad58f7a22bc997876db7403be9f32e3dd3b25
4
+ data.tar.gz: 2698a6ae3e7f568e4f9821cf85a67b4e18c03e4e
5
5
  SHA512:
6
- metadata.gz: 4991b3ee930be2c5aee68abe6461bed9f43064f881468b390a2c7e53e131711ceff2ea8112576a9ad2117e0c15ce2af434b4dc5b0db69a70b976eb8cb8669691
7
- data.tar.gz: 45e417159c0e91893f533f7d25ea1fb2d96a7be05487a4782fa9227cf5efc9b8c1e5b8c7951116f00362bcb56bfba4fb85e3acd076c71ecc7e01a064c73aa6a1
6
+ metadata.gz: 2882910533b1f26caad0079c21ce14353b66a16e58a4ace8518d806ac80cfe3ee4917dd2bb793e2072f0c39bc4e8aed2e12f7d8ce18e614a455ccd355867b94c
7
+ data.tar.gz: 7e52b94f4d8e72df47406f023efb8ba6349cc0b2e17264324d17e5dff8d9e101a5629e1df767aa55ac85f904239b1fa299ef2c2652b029b9ad6ea7e0071f5934
@@ -23,7 +23,7 @@ module Kabal
23
23
  end
24
24
 
25
25
  def self.ends_with_one?(count)
26
- count.to_s[-1] == "1"
26
+ count.to_s[-1] == "1" and (count % 100) / 10 != 1
27
27
  end
28
28
 
29
29
  def self.end_with_two_or_three_of_four?(count)
@@ -44,7 +44,6 @@ module Kabal
44
44
  end
45
45
 
46
46
  def ten_powers(number)
47
- #FIXME find better way
48
47
  return names["ten_powers"][100] if number_is_google? number
49
48
  less_thousands number if number_is_thousands? number
50
49
  return @number_name if number_is_thousands? number
@@ -65,8 +64,11 @@ module Kabal
65
64
  end
66
65
 
67
66
  def count_name(number)
68
- #FIXME number.to_S[-4] not good
69
- @feminine_name = (number.to_s[-4] == "1" or number.to_s[-4] == "2") and count(number) and count(number) / 10 != 1 and number_order(number) == 3
67
+ if (number.to_s[-4] == "1" or number.to_s[-4] == "2") and count(number) and (count(number) % 100) / 10 != 1 and number_order(number) == 3
68
+ @feminine_name = true
69
+ else
70
+ @feminine_name = false
71
+ end
70
72
  three_words count(number)
71
73
  end
72
74
 
data/lib/kabal/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kabal
2
- VERSION = "0.2.9"
2
+ VERSION = "0.2.10"
3
3
  end
@@ -45,7 +45,7 @@ class EnglishTest < TestCase
45
45
  end
46
46
  def test_hundred_random_numbers
47
47
  r = Random.new
48
- (1..65).each do |power|
48
+ (1..63).each do |power|
49
49
  number = r.rand(10 ** power)
50
50
  assert @eng.convert(number), number
51
51
  end
@@ -79,4 +79,10 @@ class RussianTest < TestCase
79
79
  assert @rus.convert(number), number
80
80
  end
81
81
  end
82
+ def test_11000
83
+ assert_equal @rus.convert(11000), "одиннадцать тысяч"
84
+ end
85
+ def test_111000
86
+ assert_equal @rus.convert(111000), "сто одиннадцать тысяч"
87
+ end
82
88
  end
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.9
4
+ version: 0.2.10
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-06-24 00:00:00.000000000 Z
11
+ date: 2014-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler