GenServerMagic v0.0.8 GenServerMagic.Utils View Source

Link to this section Summary

Functions

Names an argument based on its position

Returns only named arguments (excludes pattern matching and default values) (%{}, arg \\ []) becomes (gsm_arg0, arg)

Adds names to all unnamed args

Gives every argument a unique name replacing existing named arguments (%{}, arg \\ []) becomes (%{} = gsm_arg0, gsm_arg1 \\ [])

Removes the pattern from named arguemnts

Removes the metadata from an argument AST

Removes the default value from optional arguments

Link to this section Functions

Names an argument based on its position

Link to this function name_only_arguments(args, module) View Source

Returns only named arguments (excludes pattern matching and default values) (%{}, arg \\ []) becomes (gsm_arg0, arg)

Link to this function normalize_argument(arg, pos, module) View Source
Link to this function normalize_arguments(args, module, acc \\ []) View Source

Adds names to all unnamed args

(%{}) becomes (%{} = gsm_arg0)

Link to this function rename_arguments(args, module) View Source

Gives every argument a unique name replacing existing named arguments (%{}, arg \\ []) becomes (%{} = gsm_arg0, gsm_arg1 \\ [])

Link to this function strip_expanded_arguments(args, acc \\ []) View Source

Removes the pattern from named arguemnts

(%{} = map) becomes (map)

Link to this function strip_metadata(args, acc \\ []) View Source

Removes the metadata from an argument AST

{:var, [line: 42], MyModule} becomes {:var, [], MyModule}

Link to this function strip_optional_arguments(args, acc \\ []) View Source

Removes the default value from optional arguments