class RecipeFinder::CLI
Public Instance Methods
call()
click to toggle source
# File lib/finder/cli.rb, line 3 def call puts "Welcome to Find Anything! Where you can quickly FindAnything you want near you" start end
print_item(dish)
click to toggle source
# File lib/finder/cli.rb, line 27 def print_item(dish) puts "" puts "----------- #{dish.name} -----------" puts "" puts "Stars: #{dish.stars.to_f.round(2)}" puts "Description: #{dish.description}" puts "URL: #{dish.url}" puts "" puts "Ingredients: #{dish.ingredients.join(", ")}" puts "" puts "Prep Time: #{dish.time[0].slice(2, dish.time[0].length)}" puts "Cook Time: #{dish.time[1].slice(2, dish.time[1].length)}" puts "Ready in: #{dish.time[2].slice(2, dish.time[2].length)}" puts "" puts "Instructions:" dish.instructions.each do |ele| puts "" puts "#{ele}" end puts "To go back, type 'back'. To exit, type 'exit'" end
print_items(itemsArray)
click to toggle source
# File lib/finder/cli.rb, line 16 def print_items(itemsArray) itemsArray.each do |dish| puts "" puts "#{RecipeFinder::Dish.all.index(dish) + 1}.----------- #{dish.name} -----------" puts "" puts "Stars: #{dish.stars.to_f.round(2)}" puts "Description: #{dish.description}" puts "URL: #{dish.url}" end end
start()
click to toggle source
# File lib/finder/cli.rb, line 8 def start puts "" puts "What are you looking for?" search_item = gets.strip RecipeFinder::Scraper.new.make_items(search_item) show_list("first") end