Class: Top25TravelDestinations::CLI
- Inherits:
-
Object
- Object
- Top25TravelDestinations::CLI
- Defined in:
- lib/top_25_travel_destinations/cli.rb
Overview
controls our initiate_cli
Instance Method Summary collapse
Instance Method Details
permalink #call ⇒ Object
[View source]
5 6 7 8 9 10 11 12 13 14 15 16 |
# 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 |
permalink #choose_destination ⇒ Object
[View source]
24 25 26 27 28 29 30 31 |
# 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 |
permalink #goodbye ⇒ Object
[View source]
19 20 21 22 |
# File 'lib/top_25_travel_destinations/cli.rb', line 19 def goodbye puts "See you later for more destinations!" exit end |