cronline snippets

How to parse a cronline/crontab/cron with Ruby

Tagged cron, cronline, ruby  Languages ruby

You can use the rufus-scheduler gem to parse cronline/crontab/cron with Ruby.


gem 'rufus-scheduler'


require 'rufus/scheduler/cronline'
cron ="00 00 1 * *") # 00:00 every first day of the month
next_time = cron.next_time(Time.current)
previous_time = cron.previous_time(Time.current)

rufus-scheduler's cronline implementation:

See tests for details and syntax:

Cron configuration examples.