crontab v0.7.0 Crontab.CronFormatParser

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

Summary

Functions

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

Functions

parse(cron_format)
parse(cron_format, arg2)

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."}