kale v0.7.0 Kale.Utils View Source

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

Link to this section 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.

Link to this section Functions

Link to this function

extract_args(step) View Source
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"]
Link to this function

normalise_name(step) View Source
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 {}"