Class: RecipeCard
Constant Summary
Constants included from RecipeHelper
RecipeHelper::HEADERS, RecipeHelper::PROMPT, RecipeHelper::RECIPES_PATH
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#ingredients ⇒ Object
readonly
Returns the value of attribute ingredients.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#recipe ⇒ Object
readonly
Returns the value of attribute recipe.
-
#serves ⇒ Object
readonly
Returns the value of attribute serves.
-
#time_to_cook ⇒ Object
readonly
Returns the value of attribute time_to_cook.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, serves, description, ingredients, recipe, time_to_cook, url) ⇒ RecipeCard
constructor
A new instance of RecipeCard.
- #split_ingredients(ingredients) ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(name, serves, description, ingredients, recipe, time_to_cook, url) ⇒ RecipeCard
Returns a new instance of RecipeCard.
6 7 8 9 10 11 12 13 14 |
# File 'lib/recipe_card.rb', line 6 def initialize(name, serves, description, ingredients, recipe, time_to_cook, url) @name = name @serves = serves @description = description @ingredients = ingredients @recipe = recipe @time_to_cook = time_to_cook @url = url end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/recipe_card.rb', line 5 def description @description end |
#ingredients ⇒ Object (readonly)
Returns the value of attribute ingredients.
5 6 7 |
# File 'lib/recipe_card.rb', line 5 def ingredients @ingredients end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/recipe_card.rb', line 5 def name @name end |
#recipe ⇒ Object (readonly)
Returns the value of attribute recipe.
5 6 7 |
# File 'lib/recipe_card.rb', line 5 def recipe @recipe end |
#serves ⇒ Object (readonly)
Returns the value of attribute serves.
5 6 7 |
# File 'lib/recipe_card.rb', line 5 def serves @serves end |
#time_to_cook ⇒ Object (readonly)
Returns the value of attribute time_to_cook.
5 6 7 |
# File 'lib/recipe_card.rb', line 5 def time_to_cook @time_to_cook end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/recipe_card.rb', line 5 def url @url end |
Class Method Details
.user_recipe ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/recipe_card.rb', line 21 def self.user_recipe recipe = {} HEADERS.each do |input| puts "Type out your ingredients separated with commas eg. banana, shrimp, taco meat" if input == :ingredients puts "You need to enter a url it might be nice for inspiration?" if input == :url puts "Whats the #{input}?" print '> ' recipe[input] = gets.chomp end recipe end |
Instance Method Details
#split_ingredients(ingredients) ⇒ Object
15 16 17 |
# File 'lib/recipe_card.rb', line 15 def split_ingredients(ingredients) ingredients.split(' ') end |
#to_a ⇒ Object
18 19 20 |
# File 'lib/recipe_card.rb', line 18 def to_a [@name, @serves, @description, @ingredients, @recipe, @time_to_cook, @url] end |