From bd6fb18590bad5144fe025e2ba8981c02255b3a8 Mon Sep 17 00:00:00 2001 From: Daniel Muckerman Date: Wed, 25 Nov 2015 19:33:55 -0500 Subject: [PATCH] Catch decimal approximations --- slack-numberman/commands/calculate.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/slack-numberman/commands/calculate.rb b/slack-numberman/commands/calculate.rb index 5799ecc..4761f0b 100644 --- a/slack-numberman/commands/calculate.rb +++ b/slack-numberman/commands/calculate.rb @@ -42,10 +42,20 @@ module SlackMathbot else # Check the other possible name for real solutions solution = pods["Real solutions"] - # Prettify equivalency - solution[0].sub! "~~", "≈" - puts solution - send_message client, _data.channel, solution[0] + + if solution != nil + # Prettify equivalency + solution[0].sub! "~~", "≈" + puts solution + send_message client, _data.channel, solution[0] + else + decimal = pods["Decimal approximation"] + + if decimal != nil + puts decimal + send_message client, _data.channel, decimal[0] + end + end end end end