abaco 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/abaco/converter.rb +15 -10
- data/lib/abaco/version.rb +1 -1
- data/spec/abaco/converter_spec.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a81add9bd6a7fa2b74e154443a6f6ee32832ab
|
4
|
+
data.tar.gz: a28d4780e22db5dcb1c81742dcabbb6d32a64be1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c2933ac91cb87a559cba16fed0d7540641c81107818ea115c8dc52f2872c08d4159dc44f48e2a630737463e553fcb4627cd2a56e840c1df546947bb0d111e69
|
7
|
+
data.tar.gz: 158491ea757b26bcf34f9c56f0a0cc9984644e0379f57a6d4c42f15e244b2600790b15988f50fb86a33bfc7e260c0aa738678bc740ebb9701507a7379a085743
|
data/CHANGELOG.md
CHANGED
data/lib/abaco/converter.rb
CHANGED
@@ -48,19 +48,24 @@ module Abaco
|
|
48
48
|
number = number.to_f
|
49
49
|
|
50
50
|
tmp = number.to_i
|
51
|
-
result = ''
|
52
51
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
52
|
+
if tmp == 0
|
53
|
+
result = 'zero'
|
54
|
+
else
|
55
|
+
result = ''
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
57
|
+
9.step(3, -3) do |n|
|
58
|
+
# Is the number in the 10^n form?
|
59
|
+
if Math.log10(tmp).to_i >= n
|
60
|
+
result += describe_part(tmp / 10 ** n)
|
62
61
|
|
63
|
-
|
62
|
+
result += ' ' if n >= 6
|
63
|
+
result += SUFFIXES[n]
|
64
|
+
result += ' ' if n >= 6
|
65
|
+
end
|
66
|
+
|
67
|
+
tmp %= 10 ** n
|
68
|
+
end
|
64
69
|
end
|
65
70
|
|
66
71
|
decimal_part = '/'
|
data/lib/abaco/version.rb
CHANGED
@@ -19,7 +19,8 @@ RSpec.describe Abaco::Converter do
|
|
19
19
|
1973431 => 'un milione novecentosettantatremilaquattrocentotrentuno/00',
|
20
20
|
1999197431 => 'un miliardo novecentonovantanove milioni centonovantasettemilaquattrocentotrentuno/00',
|
21
21
|
999999999999 => 'novecentonovantanove miliardi novecentonovantanove milioni novecentonovantanovemilanovecentonovantanove/00',
|
22
|
-
288 => 'duecentottantotto/00'
|
22
|
+
288 => 'duecentottantotto/00',
|
23
|
+
0.6 => 'zero/60'
|
23
24
|
}.each_pair do |number, result|
|
24
25
|
it "converts #{number} as '#{result}'" do
|
25
26
|
expect(subject.convert(number)).to eq(result)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abaco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Desantis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.4.
|
112
|
+
rubygems_version: 2.4.5
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Convert numbers into Italian words.
|