lib/weather_cli/cli.rb
#method used to start the program
method used to start the program
method used to start the program
def start
    input = ""
    while input !="exit"
      puts "Type in a city to get its 6 day forecast:"
      input = gets.strip
      puts""
      if input  == "exit"
        puts "Goodbye!"
      else
        forecast_array = WeatherCli::Forecast.find_or_create_by_city_name(input)
        check_response
        print_weather_list(forecast_array)
        more_info(forecast_array)
        puts "Would you like to search for another city? "
        input = gets.strip.downcase
        case input 
          when "exit"
            puts "Goodbye!"
          when "no"
            puts ""
            puts  "See you next time for more weather updates, Goodbye!"
            exit
          when "n" 
            puts ""
            puts  "See you next time for more weather updates, Goodbye!"
            exit
          when "yes"
            puts "Ok" 
          when 'y'
            puts "Ok" 
          else
            puts ""
            puts "Invalid answer. Enter Yes or No."
            start
        end
      end 
    end
  end
def start input = "" while input != "exit" puts "Type in a city to get its 6 day forecast:" input = gets . strip puts "" if input == "exit" puts "Goodbye!" else forecast_array = WeatherCli :: Forecast . find_or_create_by_city_name ( input ) check_response print_weather_list ( forecast_array ) more_info ( forecast_array ) puts "Would you like to search for another city? " input = gets . strip . downcase case input when "exit" puts "Goodbye!" when "no" puts "" puts "See you next time for more weather updates, Goodbye!" exit when "n" puts "" puts "See you next time for more weather updates, Goodbye!" exit when "yes" puts "Ok" when 'y' puts "Ok" else puts "" puts "Invalid answer. Enter Yes or No." start end end end end
method used to start the program
method used to start the program