class Destinations::CLI
Public Instance Methods
call()
click to toggle source
# File lib/destinations/cli.rb, line 4 def call intro main_menu_select end
destination_link(destination)
click to toggle source
# File lib/destinations/cli.rb, line 64 def destination_link(destination) answer = gets.chomp.downcase if answer == 'more info' puts "\nPlease visit #{destination.link_url} for more information on #{destination.name}.\n\n" puts "To exit the program, enter 'exit'. To return to the main menu, enter 'main menu'." new_input = gets.chomp.downcase self.exit_or_menu(new_input) else self.exit_or_menu(answer) end end
destination_more_info(input)
click to toggle source
# File lib/destinations/cli.rb, line 45 def destination_more_info(input) more_input = gets.chomp.downcase destination = nil if more_input.to_i.between?(1,10) destination = Destinations::TravelDestinations.find_input_to_index(input, more_input) puts destination.summary puts "If you would like more information about this destination please enter 'more info'." self.destination_link(destination) elsif more_input.to_i.between?(11,40) destination = Destinations::TravelDestinations.all[more_input.to_i-1] puts destination.summary puts "If you would like more information about this destination please enter 'more info'." self.destination_link(destination) else self.exit_or_menu(more_input) end end
intro()
click to toggle source
# File lib/destinations/cli.rb, line 9 def intro Destinations::TravelDestinationsLists.scrape_list Destinations::TravelDestinations.new_countries Destinations::TravelDestinations.new_cities Destinations::TravelDestinations.new_regions Destinations::TravelDestinations.new_value puts "\nWelcome! Please select one of the lists above by number.\n\n" puts "Type 'exit' to exit the program at anytime. Type 'main menu' to return to the list above at anytime." end