YuriTemplate.RFC6570 (yuri_template v1.1.0) View Source

This module contains RFC6570-specific functions.

Link to this section Summary

Types

t()

Internal template representation. Subject to change at any time without prior notice.

Functions

Expands the template using given substitutes into an iodata/0.

Return all variables from the template.

Parses the given string to the t/0.

Link to this section Types

Specs

name_conv() :: :binary | :atom | :existing_atom | [atom()]

Specs

t()

Internal template representation. Subject to change at any time without prior notice.

Link to this section Functions

Link to this function

expand(template, substitutes)

View Source

Specs

expand(t(), Access.t()) :: iodata()

Expands the template using given substitutes into an iodata/0.

Specs

parameters(t()) :: [atom()] | [String.t()]

Return all variables from the template.

Link to this function

parse(str, name_conv \\ :atom)

View Source

Specs

parse(String.t(), name_conv()) :: {:ok, t()} | {:error, term()}

Parses the given string to the t/0.

Second argument describes how to convert variable names.

  • :atom - default, potentially unsafe. Names converted using String.to_atom/1.
  • :binary - no conversion, safe option.
  • :existring_atom or any list - more safe alternative to :atom, names converted using String.to_existing_atom/1. You can use list of atoms instead of :existing_atom to ensure that all atoms you need already exist.