numbers_and_words_pl 0.0.2 → 0.0.3

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: 2223dca941dbe7464b3e3188627b4d9b01cd7067
4
- data.tar.gz: 88ebc300a7ba747c4ba2aecdb8d07fc033540f5a
3
+ metadata.gz: 381428b4ed48473d7a03337bc63953e812ed14f1
4
+ data.tar.gz: 22ad5d11fce89abd276c939c05351bc49b4c894f
5
5
  SHA512:
6
- metadata.gz: 897c09965d77810ef72de9081b01d882c2f8c870f7cfa02c87fecc46627a3952d9e0225dd161d2ed36363fcbc9f9122c4463c0f55d19ff3d1c8170ec1f73eb1a
7
- data.tar.gz: dcda9bd03c5f27daf643471f16860dbadc5a7e2ce94440a0d27a48f87ef50d5b76347f886aef8dcd85eccb880d8880397eed0b2390d23fed1053d2734076bb4b
6
+ metadata.gz: 7b0dd9ec8ed24d5427049498b3b57cec4c30447ea7e7c4cf0a689ce772eb1441b51c7780720cc53657a58feeee981aeb5ba25ec3dcc0e064d789fb3fde9c583f
7
+ data.tar.gz: f73c8d55d94958a60f048971e96f36d6b916c760f833247bec3e5720d338e3308cb21f356afe288c3037725f2e693d82e7f04cdb9b6da4eb4c699e703a64fdd2
@@ -17,11 +17,18 @@ module NumbersAndWordsPl
17
17
  "#{PL_NUMBERS['hundreds'][hundreds]} #{to_words_pl rest if rest > 0}".strip
18
18
  when 1_000..999_999
19
19
  thousands = integer.to_s[0..-4].to_i
20
- one_few_many = thousands < 5 ? (thousands == 1 ? 'one' : 'few') : 'many'
20
+ one_few_many = case thousands
21
+ when 1
22
+ 'one'
23
+ when 2..4
24
+ 'few'
25
+ else
26
+ 'many'
27
+ end
21
28
  rest = integer.to_s[-3..-1].to_i
22
- "#{to_words_pl thousands if thousands > 1} #{PL_NUMBERS['thousands'][one_few_many]} #{to_words_pl rest if rest > 0}".strip
29
+ "#{to_words_pl thousands} #{PL_NUMBERS['thousands'][one_few_many]} #{to_words_pl rest if rest > 0}".strip
23
30
  else
24
- fail "number #{integer} not supported"
31
+ raise "number #{integer} not supported"
25
32
  end
26
33
  end
27
34
  end
@@ -1,3 +1,3 @@
1
1
  module NumbersAndWordsPl
2
- VERSION = "0.0.2"
2
+ VERSION = '0.0.3'
3
3
  end
data/spec/pl.yml CHANGED
@@ -24,8 +24,8 @@ to_words:
24
24
  990: dziewięćset dziewięćdziesiąt
25
25
  999: dziewięćset dziewięćdziesiąt dziewięć
26
26
  thousands:
27
- 1000: tysiąc
28
- 1001: tysiąc jeden
27
+ 1000: jeden tysiąc
28
+ 1001: jeden tysiąc jeden
29
29
  2000: dwa tys.
30
30
  4000: cztery tys.
31
31
  5000: pięć tys.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numbers_and_words_pl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Lang
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-05-15 00:00:00.000000000 Z
12
+ date: 2017-05-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler