class Top25TravelDestinations::CLI
controls our initiate_cli
Public Instance Methods
call()
click to toggle source
# File lib/top_25_travel_destinations/cli.rb, line 5 def call puts "Discover the top 25 travel destinations according to TripAdvisor!" while @input != "exit" Destination.list_destinations puts "Type the number next to the city that you would like more information on, or type 'exit'" @input = gets.chomp choose_destination Destination.destination_information(@input) end goodbye end
choose_destination()
click to toggle source
# File lib/top_25_travel_destinations/cli.rb, line 24 def choose_destination if @input == "exit" goodbye elsif !@input.to_i.between?(1,25) puts "Incorrect input, try again" @input = gets.chomp.to_i end end
goodbye()
click to toggle source
# File lib/top_25_travel_destinations/cli.rb, line 19 def goodbye puts "See you later for more destinations!" exit end