plymio_funcio v0.1.0 Plymio.Funcio.Utility View Source
General Functions.
See Plymio.Funcio
for overview and documentation terms.
Link to this section Summary
Functions
normalise_fun_name/1
normalise the argument to a function name, returning {:ok, argument}
or {:error, error}
if not
normalise_fun_names/1
calls
Plymio.Fontais.Utility.list_wrap_flat_just/1
on its argument and
then calls normalise_fun_name/1
on each, returning {:ok, fun_names}
or {:error, error}
validate_fun_name/1
checks whether the argument is an Atom
, returenin {:ok, argument}
or {:error, error}
validate_fun_names/1
takes a list of fun names and calls validate_fun_name/1
on each, returning {:ok, fun_names}
or {:error, error}
Link to this section Types
Link to this section Functions
normalise_fun_name/1
normalise the argument to a function name, returning {:ok, argument}
or {:error, error}
if not.
If the argument is an atom, it is passed through transparently.
If the argument is a string, it is converted to an atom.
Examples
iex> :fun_one |> normalise_fun_name
{:ok, :fun_one}
iex> "fun_one" |> normalise_fun_name
{:ok, :fun_one}
iex> {:error, error} = 42 |> normalise_fun_name
...> error |> Exception.message
"fun name invalid, got: 42"
normalise_fun_names/1
calls
Plymio.Fontais.Utility.list_wrap_flat_just/1
on its argument and
then calls normalise_fun_name/1
on each, returning {:ok, fun_names}
or {:error, error}
.
Examples
iex> [:fun_one] |> normalise_fun_names
{:ok, [:fun_one]}
iex> [:fun_one, :fun_due, "fun_tre"] |> normalise_fun_names
{:ok, [:fun_one, :fun_due, :fun_tre]}
iex> {:error, error} = [:fun_one, 42, "HelloWorld"] |> normalise_fun_names
...> error |> Exception.message
"fun name invalid, got: 42"
validate_fun_name/1
checks whether the argument is an Atom
, returenin {:ok, argument}
or {:error, error}
.
Examples
iex> :fun_one |> validate_fun_name
{:ok, :fun_one}
iex> {:error, error} = 42 |> validate_fun_name
...> error |> Exception.message
"fun name invalid, got: 42"
validate_fun_names/1
takes a list of fun names and calls validate_fun_name/1
on each, returning {:ok, fun_names}
or {:error, error}
.
Examples
iex> [:fun_one] |> validate_fun_names
{:ok, [:fun_one]}
iex> [:fun_one, :fun_due, :fun_tre] |> validate_fun_names
{:ok, [:fun_one, :fun_due, :fun_tre]}
iex> {:error, error} = [:fun_one, 42, "HelloWorld"] |> validate_fun_names
...> error |> Exception.message
"fun name invalid, got: 42"