crontab v0.8.0 Crontab.CronFormatParser

Parse string like * * * * * * to a %Crontab.CronInterval{} or %Crontab.ExtendedCronInterval{}.

Summary

Functions

Parse string like * * * * * * to a %Crontab.CronInterval{}

Types

result()
result ::
  {:ok, Crontab.ExtendedCronInterval.all_t} |
  {:error, binary}

Functions

parse(cron_format, extended \\ false)
parse(binary, boolean) :: result

Parse string like * * * * * * to a %Crontab.CronInterval{}.

Examples

iex> Crontab.CronFormatParser.parse "* * * * *"
{:ok,
  %Crontab.CronInterval{day: [:*], hour: [:*], minute: [:*],
  month: [:*], weekday: [:*], year: [:*]}}

iex> Crontab.CronFormatParser.parse "* * * * *", true
{:ok,
  %Crontab.ExtendedCronInterval{day: [:*], hour: [:*], minute: [:*],
  month: [:*], weekday: [:*], year: [:*], second: [:*]}}

iex> Crontab.CronFormatParser.parse "fooo"
{:error, "Can't parse fooo as interval minute."}