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_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
exit_or_menu(new_answer) click to toggle source
# File lib/destinations/cli.rb, line 76
def exit_or_menu(new_answer)
  if new_answer == "main menu"
    self.main_menu
  elsif new_answer == "exit"
      abort("Bye!")
  else
    puts "To exit the program, enter 'exit'. To return to the main menu, enter 'main menu'."
      more_answer = gets.chomp.downcase
    self.exit_or_menu(more_answer)
  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
main_menu() click to toggle source
main_menu_select() click to toggle source