matheus 0.6.2 → 0.6.3
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/matheus/convert_currency.rb +3 -1
- data/lib/matheus/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8b7ae705faac28863e66c70a5c908c53a2fe180aa14c0878aef57ae82ca8421
|
4
|
+
data.tar.gz: e89436cbe02bbc48261114ff617a39d42f52f0d2aae1b178ddd55036ace7d92d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8dd9bbb999502ef1689a75115844a32eaa131b92e41c665f00f9d9337e1d9a80669ad1c475ca5ddcb1313c4bfdd53bcfe31763a99b823a00bac96e4de46a49a
|
7
|
+
data.tar.gz: fe9f27e3980c294dbb6e06b17f9f66c214432fceae199725caf33de20e1998037d2716266238465c90567996ddae14fd88820c7f2e90672b442120af92a0000d
|
@@ -8,6 +8,8 @@ module Matheus
|
|
8
8
|
# $ convert-currency 100 usd eur 2024-03-06
|
9
9
|
# $ convert-currency usd eur # defaults to 1
|
10
10
|
class ConvertCurrency < Command
|
11
|
+
include ActiveSupport::NumberHelper
|
12
|
+
|
11
13
|
def call(args)
|
12
14
|
amount, source, target, date = parse_args(args)
|
13
15
|
|
@@ -17,7 +19,7 @@ module Matheus
|
|
17
19
|
|
18
20
|
if rate
|
19
21
|
converted = amount * rate
|
20
|
-
puts "#{amount} #{source.upcase} = #{
|
22
|
+
puts "#{number_to_currency(amount, unit: "")} #{source.upcase} = #{number_to_currency(converted, unit: "")} #{target.upcase}"
|
21
23
|
else
|
22
24
|
Failure("Conversion rate from #{source.upcase} to #{target.upcase} not found")
|
23
25
|
end
|
data/lib/matheus/version.rb
CHANGED