jake-scripts 2.0.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2ea0a6772ce2fe56dd66e9c7f0ae4882eff24680
4
- data.tar.gz: d29417796bf90f034b1a0ee6102f83d50eda22be
2
+ SHA256:
3
+ metadata.gz: 77682470dc3d4ef1fc5c1ff87c0a93ac609870e85979b68c0f0bfbca41720f5c
4
+ data.tar.gz: 0a02bc7ace13d8c6eded95109be611a906cd14d4e2c2c9295c292ac323a81c7f
5
5
  SHA512:
6
- metadata.gz: fc7f110312fc6efafc414f0b60187b05613ca1b0ca32c9e50f215a7fc4b3bfbd3692df3659be68326f384a95da6ae9c1455df97217aa5fe0e945601191ef41ab
7
- data.tar.gz: 2ee209169307a2ec8eda247eea4a534b960980649e84c937379efee68844fb521e6f5a87f38e2474626c87ea66e6f13ce76cb046ab7da94255f39defdf9b3589
6
+ metadata.gz: f20bafb4d74f24a02c00a9d0bd5c7beea662cf954bb93b418cfc99e8700fb61c4a2c5e6c21a5acf1f5da73252ba5116eafce7fcc201e036e6677cbeae69c3224
7
+ data.tar.gz: 4e7c613d2355a17417e5b970eaad5ee1d721511341d37ccf0f67f696c6be0fc8be1f88f34cc22b6f1cdee4c8baa9e77da59bc592d98cf5ec7b5c5e9678598bc0
data/exe/currency CHANGED
@@ -13,13 +13,14 @@ require 'monetize'
13
13
 
14
14
  def conversion
15
15
  # User input
16
- puts
17
- print "Base => "
18
- base_currency = gets.chomp.upcase
19
- print "Amount => "
20
- initial_amount = gets.chomp
21
- print "Convert to => "
22
- convert_to = gets.chomp.upcase
16
+ begin
17
+ base_currency = ARGV[0].upcase
18
+ initial_amount = ARGV[1]
19
+ convert_to = ARGV[2].upcase
20
+ rescue
21
+ puts 'Input Error'
22
+ exit(1)
23
+ end
23
24
 
24
25
  # Fetches API info
25
26
  begin
@@ -38,18 +39,23 @@ def conversion
38
39
  I18n.enforce_available_locales = false
39
40
 
40
41
  # Creates money exchange rate and new money object
41
- Money.add_rate(base_currency, convert_to, convert_factor)
42
+ begin
43
+ Money.add_rate(base_currency, convert_to, convert_factor)
44
+ rescue Money::Currency::UnknownCurrency
45
+ puts 'Invalid Currency'
46
+ exit(1)
47
+ end
42
48
  initial = Monetize.parse("#{base_currency} #{initial_amount}")
43
49
  final_convert = initial.exchange_to(convert_to)
44
50
 
45
51
  # Output formatting
46
52
  puts
47
- puts '================'
48
- puts "| #{base_currency} to #{convert_to}"
49
- puts "| RATE: #{convert_factor}"
50
- puts "| #{base_currency}: #{initial.format}"
51
- puts "| #{convert_to}: #{final_convert.format}"
52
- puts '================'
53
+ puts '================='
54
+ puts "#{base_currency} to #{convert_to}"
55
+ puts "Rate: #{convert_factor}"
56
+ puts "#{base_currency}: #{initial.format}"
57
+ puts "#{convert_to}: #{final_convert.format}"
58
+ puts '================='
53
59
  puts
54
60
  end
55
61
 
@@ -1,5 +1,5 @@
1
1
  module Jake
2
2
  module Scripts
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jake-scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Meyer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-20 00:00:00.000000000 Z
11
+ date: 2018-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  version: '0'
224
224
  requirements: []
225
225
  rubyforge_project:
226
- rubygems_version: 2.5.2
226
+ rubygems_version: 2.7.6
227
227
  signing_key:
228
228
  specification_version: 4
229
229
  summary: Gem containing my scripts, tools, and utilities