Top Level Namespace

Defined Under Namespace

Modules: RecipeFinder

Instance Method Summary collapse

Instance Method Details

#endingObject



93
94
95
96
97
98
# 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_endObject



81
82
83
84
85
86
87
88
89
90
# 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) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# 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