Cronex v0.4.0 Cronex.Parser

This modules is responsible for time parsing.

Summary

Functions

Parses a given interval, frequency and time to a tuple

Parses a given frequency and time to a tuple

Functions

parse_interval_frequency(interval, frequency, time \\ "00:00")

Parses a given interval, frequency and time to a tuple.

interval is a function wich receives one argument and returns the remainder of the division of that argument by the given interval

Example

iex> Cronex.Parser.parse_interval_frequency(2, :hour)
{0, interval, :*, :*, :*}

iex> Cronex.Parser.parse_interval_frequency(2, :invalid_day)
:invalid
parse_regular_frequency(frequency, time \\ "00:00")

Parses a given frequency and time to a tuple.

Example

iex> Cronex.Parser.parse_regular_frequency(:hour)
{0, :*, :*, :*, :*}

iex> Cronex.Parser.parse_regular_frequency(:day, "10:00")
{0, 10, :*, :*, :*}

iex> Cronex.Parser.parse_regular_frequency(:day, "12:10")
{10, 12, :*, :*, :*}

iex> Cronex.Parser.parse_regular_frequency(:wednesday, "12:00")
{0, 12, :*, :*, 3}

iex> Cronex.Parser.parse_regular_frequency(:non_existing_day)
:invalid

iex> Cronex.Parser.parse_regular_frequency(:monday, "invalid time")
:invalid