summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xblaunits.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/blaunits.rb b/blaunits.rb
index ffa6578..39557a3 100755
--- a/blaunits.rb
+++ b/blaunits.rb
@@ -84,6 +84,13 @@ begin
puts "Invalid input! Try !convert [amount] [from-unit] to [to-unit] e.g !convert 2 cm to inches"
exit
end
+ if from == "F" && to == "C"
+ temp = (num - 32) / 1.8
+ puts "#{num} F = #{temp} C"
+ elsif from == "C" && to == "F"
+ temp = (num * 1.8) + 32
+ puts "#{num} C = #{temp} F"
+ else
out = %x(#{BINARY_NAME} -t1 #{from} #{to})
outs = out.split(" ")
if outs[0] == "Unknown"
@@ -124,4 +131,5 @@ begin
end
puts "#{num} #{from} = #{num * Float(out)} #{to}"
+ end
end