Class: Zutat::Recipe
- Inherits:
-
Object
- Object
- Zutat::Recipe
- Defined in:
- lib/zutat/recipe.rb
Instance Attribute Summary collapse
-
#ingredients ⇒ Object
Returns the value of attribute ingredients.
-
#nutrient_targets ⇒ Object
Returns the value of attribute nutrient_targets.
Instance Method Summary collapse
-
#initialize(p) ⇒ Recipe
constructor
A new instance of Recipe.
Constructor Details
#initialize(p) ⇒ Recipe
Returns a new instance of Recipe.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/zutat/recipe.rb', line 5 def initialize(p) @json = JSON.parse(p) @ingredients = Array.new @json["ingredients"].each do |n| ingredient = Zutat::Ingredient.new(n) @ingredients << ingredient end @nutrient_targets = Zutat::NutrientTargets.new(@json["nutrientTargets"]) end |
Instance Attribute Details
#ingredients ⇒ Object
Returns the value of attribute ingredients.
3 4 5 |
# File 'lib/zutat/recipe.rb', line 3 def ingredients @ingredients end |
#nutrient_targets ⇒ Object
Returns the value of attribute nutrient_targets.
3 4 5 |
# File 'lib/zutat/recipe.rb', line 3 def nutrient_targets @nutrient_targets end |