diff options
author | Joe Robinson <joe@lc8n.com> | 2017-11-09 16:43:46 +0000 |
---|---|---|
committer | Joe Robinson <joe@lc8n.com> | 2017-11-09 16:43:46 +0000 |
commit | c30c9433d9e672d92e516936808b220180b0264d (patch) | |
tree | 5b14995ff917512ce069e63cd67ae659cab8f52e | |
parent | 77587c1af9651c7c96b3aa3579dfed4a05df5dc6 (diff) |
Allow converting from normal currency to crypto
-rwxr-xr-x | blaunits.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/blaunits.rb b/blaunits.rb index 5aef90c..257927f 100755 --- a/blaunits.rb +++ b/blaunits.rb @@ -121,12 +121,17 @@ begin units_error = out out = get_crypto_price(from, to) if out.split(" ")[0] == "Error:" - if units_error.split(" ")[1] == "Incompatible" - puts units_error + reverse_out = get_crypto_price(to, from) + if reverse_out.split(" ")[0] == "Error:" + if units_error.split(" ")[1] == "Incompatible" + puts units_error + else + puts out + end + exit else - puts out + out = 1/Float(reverse_out) end - exit end end |