-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.rb
43 lines (37 loc) · 910 Bytes
/
view.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class View
def ask_for_recipe_name
puts 'What is the recipe name?'
print '> '
gets.chomp
end
def ask_for_description
puts 'What is the description of the recipe?'
print '> '
gets.chomp
end
def list_recipes(recipes)
if recipes.empty?
puts "You don't have any recipes in your cookbook."
else
puts "\n *** List of recipes ***"
recipes.each_with_index do |recipe, index|
puts "#{index + 1}. [ ] #{recipe.name}: #{recipe.description} - #{recipe.prep_time}"
end
end
end
def remove_recipe
puts 'What is the recipe number you want to destroy?'
print '> '
gets.chomp.to_i - 1
end
def ask_for_ingredient
puts 'What ingredient would you like a recipe for?'
print '> '
gets.chomp
end
def choose_recipe
puts 'What is the recipe index that you want?'
print '> '
gets.chomp.to_i - 1
end
end