Treeprit.run_if
You're seeing just the function
run_if
, go back to Treeprit module for more information.
Specs
run_if( %Treeprit{ errors: term(), failed_operations: term(), names: term(), operations: term(), results: term(), skipped_operations: term(), successful_operations: term(), total_operations: term() }, atom(), atom() | function(), boolean() ) :: %Treeprit{ errors: term(), failed_operations: term(), names: term(), operations: term(), results: term(), skipped_operations: term(), successful_operations: term(), total_operations: term() }
Run if satisfy a condition
Examples
iex> Treeprit.new() |> Treeprit.run_if(:first, fn _ -> {:ok, "skipped"} end, false) |> Treeprit.run_if(:second, fn _ -> {:ok, "not skipped"} end, true) |> Treeprit.finally()
%Treeprit{
results: %{
second: "not skipped",
},
errors: %{},
successful_operations: 1,
failed_operations: 0,
skipped_operations: 1,
total_operations: 2
}