diff --git a/lib/yelpme.rb b/lib/yelpme.rb index cf6b68c..aee5a79 100644 --- a/lib/yelpme.rb +++ b/lib/yelpme.rb @@ -76,7 +76,8 @@ def self.nearby(lat, long) # Returns output! def self.output(business, options) - text = unless options[:full_output] + begin + text = unless options[:full_output] %{ Name: #{business.name} Rating: #{business.rating} @@ -86,9 +87,12 @@ def self.output(business, options) Phone: \e[33m#{business.phone rescue "No Number Posted"}\e[0m }.gsub(/^ {8}/, '') - else - business - end + else + business + end + rescue + text = "No business found.\nPlease ensure your business or search terms are typed correctly." + end options[:full_output] ? (pp text) : (puts text) end