ExKcal.Recipe (ExKcal v0.0.5)

ExKcal.Recipe splits preparation task into the list of steps.

Link to this section Summary

Types

t()

Type representing recipe.

Amount of substance and unit it is represented in.

Functions

Delete instance of ExKcal.Recipe.Step from ExKcal.Recipe by its index.

Construct new instance of ExKcal.Recipe struct.

Calculate total nutritional value of the ExKcal.Products used in the ExKcal.Recipe. It returns kind of a special ExKcal.Product instance containing sum of all of the relevant fields, from all of the used Products.

Link to this section Types

Specs

t() :: %ExKcal.Recipe{steps: [ExKcal.Recipe.Step.t()]}

Type representing recipe.

Specs

volume() :: {float(), :l | :dl | :ml} | {nil, :none}

Specs

weight() :: {float(), :kg | :g | :mg | :μg} | {nil, :none}

Amount of substance and unit it is represented in.

Link to this section Functions

Link to this function

add_step(recipe, step)

Specs

add_step(t(), ExKcal.Recipe.Step.t()) :: t()

Add ExKcal.Recipe.Step to ExKcal.Recipe.

Link to this function

delete_step(recipe, step_index)

Specs

delete_step(t(), non_neg_integer()) :: t()

Delete instance of ExKcal.Recipe.Step from ExKcal.Recipe by its index.

Specs

new() :: t()

Construct new instance of ExKcal.Recipe struct.

Link to this function

total_nutrition(recipe)

Specs

total_nutrition(t()) :: %ExKcal.Product{
  alcohols: term(),
  brand: term(),
  carbs: term(),
  description: term(),
  fats: term(),
  kcal: term(),
  minerals: term(),
  name: term(),
  note: term(),
  origin: term(),
  produced: term(),
  producer: term(),
  proteins: term(),
  salt: term(),
  vitamins: term(),
  volume: term(),
  weight: term()
}

Calculate total nutritional value of the ExKcal.Products used in the ExKcal.Recipe. It returns kind of a special ExKcal.Product instance containing sum of all of the relevant fields, from all of the used Products.

Notes

  • Function doesn't take units into account.
  • It won't recalculate total fields, it will sum their values.