From c30c9433d9e672d92e516936808b220180b0264d Mon Sep 17 00:00:00 2001 From: Joe Robinson Date: Thu, 9 Nov 2017 16:43:46 +0000 Subject: Allow converting from normal currency to crypto --- blaunits.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'blaunits.rb') 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 -- cgit v1.2.3