Project

chrono

0.03
Low commit activity in last 3 years
No release in over a year
Provides a chain of logics about chronology.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.4.0

Runtime

 Project Readme

Chrono

test Gem Version

Provides a chain of logics about chronology.

Trigger

Waits till scheduled time and then triggers a given job. #run is a periodic version of #once.

trigger = Chrono::Trigger.new("30 * * * *") { Time.now }
trigger.once #=> 2000-01-01 00:30:00
trigger.run  #=> 2000-01-01 01:30:00
             #=> 2000-01-01 02:30:00
             #=> 2000-01-01 03:30:00
             #=> ...

Iterator

Parses cron syntax and determines next scheduled run.

iterator = Chrono::Iterator.new("30 * * * *")
iterator.next #=> 2000-01-01 00:30:00
iterator.next #=> 2000-01-01 01:30:00
iterator.next #=> 2000-01-01 02:30:00

Syntax

The following syntax is supported. See the examples for more details.

  • (*) Asterisk
  • (,) Comma
  • (-) Hyphen
  • (/) Slash
* * * * *
T T T T T
| | | | `- wday --- 0 ..  6 (0 = Sunday)
| | | `--- month -- 1 .. 12
| | `----- day ---- 1 .. 31
| `------- hour --- 0 .. 23
`--------- minute - 0 .. 59