ExKcal.Recipe (ExKcal v0.0.6)

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

Link to this section Summary

Types

Known SI prefixes.

t()

Type representing recipe.

Volume of substance and unit it is represented in.

Weight 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

si_prefix() ::
  :Y
  | :Z
  | :E
  | :P
  | :T
  | :G
  | :M
  | :k
  | :h
  | :da
  | :d
  | :c
  | :m
  | :μ
  | :n
  | :p
  | :f
  | :a
  | :z
  | :y

Known SI prefixes.

Specs

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

Type representing recipe.

Specs

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

Volume of substance and unit it is represented in.

Specs

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

Weight 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.t()

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

  • It won't recalculate total fields, it will sum their values.