money_to_text 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/money_to_text.rb +13 -6
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31454683e4488382a65c5ad7c16d7de0e5aa3e5545b817ec2fe0f7e036cc2d1e
|
|
4
|
+
data.tar.gz: da1b11964f1485f75e4e1ab12b314a6122d306aa64f7b7eca9c15af54ccbd627
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1d1bce5a4d965c21f02283e456fb3525732a1924d50fadea2d51e344027cf312566e8f0312b60286bb040079673a6d9599c97145d3a2219cf2ff88f15b859d72
|
|
7
|
+
data.tar.gz: 5f00cdb7fe80b525ca8f125b974104fa99a7809c0757035b3a29e395f2f935ce841abf5650a372954b0e05b522d92d36ab5a2ce1f9049fbb3a9d5f197456d155
|
data/lib/money_to_text.rb
CHANGED
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
require "date"
|
|
4
4
|
|
|
5
5
|
class MoneyToText
|
|
6
|
-
def self.get_text(money = "
|
|
6
|
+
def self.get_text(money = "98128765")
|
|
7
7
|
parteEntera = money.to_i
|
|
8
8
|
triUnidades = ((parteEntera % 1000))
|
|
9
9
|
triMiles = ((parteEntera / 1000) % 1000)
|
|
10
10
|
triMillones = ((parteEntera / 1000000) % 1000)
|
|
11
11
|
triMilMillones = ((parteEntera / 1000000000) % 1000)
|
|
12
|
+
puts triUnidades
|
|
13
|
+
puts triMiles
|
|
14
|
+
puts triMillones
|
|
15
|
+
puts triMilMillones
|
|
12
16
|
|
|
13
17
|
response = ""
|
|
14
18
|
return "Cero" if parteEntera == 0
|
|
15
19
|
|
|
16
20
|
if triMilMillones > 0
|
|
17
|
-
response << triTexto(triMilMillones) << "
|
|
21
|
+
response << triTexto(triMilMillones) << "Mil "
|
|
18
22
|
end
|
|
19
23
|
|
|
20
24
|
if triMillones > 0
|
|
@@ -23,9 +27,9 @@ class MoneyToText
|
|
|
23
27
|
|
|
24
28
|
if triMilMillones == 0 && triMillones == 1
|
|
25
29
|
response << "Millón "
|
|
26
|
-
else
|
|
30
|
+
else if triMilMillones > 0 || triMillones > 0
|
|
27
31
|
response << "Millones "
|
|
28
|
-
end
|
|
32
|
+
end end
|
|
29
33
|
|
|
30
34
|
if triMiles > 0
|
|
31
35
|
response << triTexto(triMiles) << "Mil "
|
|
@@ -80,8 +84,11 @@ class MoneyToText
|
|
|
80
84
|
return response << "quince " if unidades == 5
|
|
81
85
|
return response << "Dieci"
|
|
82
86
|
when 2
|
|
83
|
-
unidades == 0
|
|
84
|
-
|
|
87
|
+
if unidades == 0
|
|
88
|
+
return response << "veinte "
|
|
89
|
+
else
|
|
90
|
+
response << "veinti"
|
|
91
|
+
end
|
|
85
92
|
when 3
|
|
86
93
|
response << "treinta "
|
|
87
94
|
when 4
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: money_to_text
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dario Paez
|
|
@@ -19,11 +19,11 @@ extra_rdoc_files: []
|
|
|
19
19
|
files:
|
|
20
20
|
- README.md
|
|
21
21
|
- lib/money_to_text.rb
|
|
22
|
-
homepage: https://
|
|
22
|
+
homepage: https://github.com/dario1091/money_to_text
|
|
23
23
|
licenses:
|
|
24
24
|
- MIT
|
|
25
25
|
metadata:
|
|
26
|
-
source_code_uri: https://github.com/dario1091/
|
|
26
|
+
source_code_uri: https://github.com/dario1091/money_to_text
|
|
27
27
|
post_install_message:
|
|
28
28
|
rdoc_options: []
|
|
29
29
|
require_paths:
|