class Object

Public Instance Methods

ending() click to toggle source
# File lib/finder/cli.rb, line 93
def ending
  puts ""
  puts "Thank you for using this gem!"
  puts "Hope you use RecipeFinder again."
  exit
end
repeat_end() click to toggle source
# File lib/finder/cli.rb, line 81
def repeat_end
  puts "Would you like to search for something else? Enter yes or no."
  restart_input = gets.strip
  if restart_input == "yes"
    RecipeFinder::Dish.reset
    start
  else
    ending
  end
end
show_list(num) click to toggle source
# File lib/finder/cli.rb, line 50
def show_list(num)
  five = RecipeFinder::Dish.show(num)
  print_items(five)
  puts "Would you like to see more info about one of these? Enter its number, or no."
  more_info = gets.strip
  if more_info != "no"
    index = more_info.to_i
    specific_item = RecipeFinder::Dish.find(index)
    RecipeFinder::Scraper.new.more_info(specific_item)
    print_item(specific_item)
    next_action = gets.strip
    if next_action == "exit"
      ending
    else
      show_list(num)
    end
  else
    if (num == "first")
      puts "Wants to see more search results? Enter yes or no."
      more_results = gets.strip
      if more_results != "no"
        show_list("next")
      else
        repeat_end
      end
    else
      repeat_end
    end
  end
end