Feel.Runtime.TemporalText (feel v0.1.0)

Copy Markdown View Source

Reads the text of a time or a date and time as DMN 1.6 writes it, and as the extensions that are on spell it (D-81).

The functions time(from) and date and time(from) read their text this way (Feel.Builtin.Conversion), and so do the endpoints of the text of range(from) (Feel.Runtime.RangeText, D-45).

iex> env = Feel.Runtime.Env.new()
iex> Feel.Runtime.TemporalText.read(env, "13:30:00", &Feel.Value.Time.parse/1) |> elem(0)
:ok
iex> Feel.Runtime.TemporalText.read(env, "13:30", &Feel.Value.Time.parse/1)
:error
iex> env = Feel.Runtime.Env.new(extensions: Feel.Extensions.new([:camunda]))
iex> {:ok, time, spelled} = Feel.Runtime.TemporalText.read(env, "13:30", &Feel.Value.Time.parse/1)
iex> {time.hour, Enum.map(Feel.Runtime.Env.diagnostics(spelled), & &1.code)}
{13, [:temporal_spelling]}

Summary

Functions

Reads text with parse, and if that does not read it, as the extensions spell it.

Functions

read(env, text, parse)

Reads text with parse, and if that does not read it, as the extensions spell it.

{:ok, value} for the text as DMN 1.6 writes it, {:ok, value, env} for another spelling, with the :info :temporal_spelling reported in env (once for a text in a run), and :error for a text that nothing reads.