Zot.Utils (zot v0.19.0)

View Source

Private utility functions.

Summary

Functions

Retrieves the :coerce flag from the given options.

Compiles a glob pattern into an anchored regex.

Checks if the given value is an MFA tuple.

Checks if the given value is a relative date time tuple.

Checks if the given value is a valid path segment.

Parses an float from the given value.

Parses an integer from the given value.

Resolves the given value which can be a literal value, a function or an MFA tuple.

Pattern matches a Zot type struct, assigning its module to the given variable.

Functions

coerce_flag(opts)

@spec coerce_flag(keyword()) :: boolean() | :unsafe

Retrieves the :coerce flag from the given options.

glob(glob)

@spec glob(glob) :: Regex.t() when glob: String.t()

Compiles a glob pattern into an anchored regex.

* matches any run of characters short of a /, ? matches exactly one of the same, ** also crosses slashes, [a-c] and [!a-c] are character classes, and {jpg,png} matches either alternative. Everything else means itself.

is_mfa(value)

(macro)

Checks if the given value is an MFA tuple.

is_relative(value)

(macro)

Checks if the given value is a relative date time tuple.

is_segment(value)

(macro)

Checks if the given value is a valid path segment.

parse_float(value)

@spec parse_float(term()) :: {:ok, float()} | :error

Parses an float from the given value.

parse_integer(value)

@spec parse_integer(term()) :: {:ok, integer()} | :error

Parses an integer from the given value.

resolve(mfa)

@spec resolve(mfa()) :: term()
@spec resolve((-> term())) :: term()
@spec resolve(term()) :: term()

Resolves the given value which can be a literal value, a function or an MFA tuple.

type(var)

(macro)

Pattern matches a Zot type struct, assigning its module to the given variable.