coins 0.1.0 → 0.1.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/coins.rb +22 -0
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 146f4415f32eb120c65fd03e406a029d62b04228
4
- data.tar.gz: 55b9d2afd5e44cbf44db09c12bec9323e2847f6d
3
+ metadata.gz: e1951d33225a76cdc69e5085f3538237cb5a11d7
4
+ data.tar.gz: 7a48ab04299e370aacf1e6ec009336143cedba9b
5
5
  SHA512:
6
- metadata.gz: a98b5670f48723835371f6c3a591d30ad8e8441d09e38cb8ec3b1c4733149b739838752b87e60e7b6300a779278ef9de64382159179e5e669b40e220b886d0d8
7
- data.tar.gz: ecccf51e9ac3603da31183a0b5cb949bc28b8d5b96bab1c5d069f90d88ef5ae7ac042cb1825cbaeb1bc73c334dd9aa4313e3df0152708cb2e7839bdeb16ce4f0
6
+ metadata.gz: 215f051426e074dc9ad173e59ba6b603a6132e307cd1b2d114753f90b737cf208911188736da29287f40b19ad1c81b8764009bf1458b7d1ebeb1913f56b770fe
7
+ data.tar.gz: 81cd327557da10d4c09b9d8149ac41adcb7510d6f09c95483dc20633a83d4d7c8200363323b3700ef86eaebc4be9c171d8d4a4a449667dc1811e6ff49d7cc208
@@ -15,6 +15,23 @@ class Coins
15
15
  end
16
16
  end
17
17
 
18
+ def help
19
+ puts "\n A simple live terminal currency exchange rate converter in Ruby\n"\
20
+ " The currencies are retrieved from fixer.io which is a\n"\
21
+ " 'Foreign exchange rates and currency conversion API'\n"\
22
+ " which is a JSON API published by the 'European Central Bank'.\n\n"\
23
+ " The rates are updated daily around 4 PM CET\n\n"\
24
+ " Usage:\n"\
25
+ " \"coins [rate(s)] [base/against] / [from] num(float/int ){CUR} [to] {CUR}\"\n"\
26
+ " where CUR is the three letter currency "
27
+ " (e.g. USD, GBP NOK, EUR, RUB, etc...)\n\n"\
28
+ " use 'from `n` `CUR` to `CUR(other)`' toconvert between currencies.\n\n"\
29
+ " use 'rates' to list all rates (see `base` also) or 'rate `CUR`'\n"\
30
+ " to see the rate for one single currency.\n\n"\
31
+ " use 'base `CUR`' or 'agains `CUR`' to change what the exchange rates compare to.\n"
32
+ " Default rate base is USD\n\n"
33
+ end
34
+
18
35
  def args? this
19
36
  if ARGV.include? this
20
37
  return true
@@ -38,6 +55,11 @@ class Coins
38
55
 
39
56
 
40
57
  def parseArgs
58
+ if ARGV.empty? || args?('help') || args?('h') || args?('-h') || args?('--h')
59
+ help
60
+ exit 1
61
+ end
62
+
41
63
  if args?('base')
42
64
  setRate(ARGV[ARGV.index('base') + 1].upcase)
43
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Demonstrandum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-16 00:00:00.000000000 Z
11
+ date: 2017-05-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A live terminal currency exchange rate converter
14
14
  email: knutsen@jetspace.co
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  version: '0'
40
40
  requirements: []
41
41
  rubyforge_project:
42
- rubygems_version: 2.6.11
42
+ rubygems_version: 2.6.12
43
43
  signing_key:
44
44
  specification_version: 4
45
45
  summary: Terminal currency converter