View Source Kale.Utils (kale v0.8.1)

Utility functions, used by macros and the functions they create.

Summary

Functions

Return the interpolated variables or argument names from a string. Elements in the returned list will always be strings.

Remove interpolated variables from a step string, so that the call matches the definition.

Functions

@spec extract_args(String.t()) :: [String.t()]

Return the interpolated variables or argument names from a string. Elements in the returned list will always be strings.

iex> Kale.Utils.extract_args("When I add {a} and{b}")
["a", "b"]

iex> Kale.Utils.extract_args("When I add {1} and{2}")
["1", "2"]
@spec normalise_name(String.t()) :: String.t()

Remove interpolated variables from a step string, so that the call matches the definition.

iex> Kale.Utils.normalise_name("I log on as {username}")
"I log on as {}"

iex> Kale.Utils.normalise_name("I log on as {fred}")
"I log on as {}"