Class: RecipeFinder::CLI
- Inherits:
-
Object
- Object
- RecipeFinder::CLI
- Defined in:
- lib/finder/cli.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
3 4 5 6 |
# 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) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# 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) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# 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 ⇒ Object
8 9 10 11 12 13 14 |
# 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 |