coins 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/coins.rb +22 -0
- 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: e1951d33225a76cdc69e5085f3538237cb5a11d7
|
4
|
+
data.tar.gz: 7a48ab04299e370aacf1e6ec009336143cedba9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 215f051426e074dc9ad173e59ba6b603a6132e307cd1b2d114753f90b737cf208911188736da29287f40b19ad1c81b8764009bf1458b7d1ebeb1913f56b770fe
|
7
|
+
data.tar.gz: 81cd327557da10d4c09b9d8149ac41adcb7510d6f09c95483dc20633a83d4d7c8200363323b3700ef86eaebc4be9c171d8d4a4a449667dc1811e6ff49d7cc208
|
data/lib/coins.rb
CHANGED
@@ -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.
|
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-
|
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.
|
42
|
+
rubygems_version: 2.6.12
|
43
43
|
signing_key:
|
44
44
|
specification_version: 4
|
45
45
|
summary: Terminal currency converter
|