Class: Zutat::Recipe

Inherits:
Object
  • Object
show all
Defined in:
lib/zutat/recipe.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ingredientsObject

Returns the value of attribute ingredients.



3
4
5
# File 'lib/zutat/recipe.rb', line 3

def ingredients
  @ingredients
end

#nutrient_targetsObject

Returns the value of attribute nutrient_targets.



3
4
5
# File 'lib/zutat/recipe.rb', line 3

def nutrient_targets
  @nutrient_targets
end