Sha256: 5824dac02d26f8822dbd80f56548bd409635de4f7ccc57d4476ee6a672c7c3bb

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

# Chrono [![Build Status](https://travis-ci.org/r7kamura/chrono.png)](https://travis-ci.org/r7kamura/chrono) [![Code Climate](https://codeclimate.com/github/r7kamura/chrono.png)](https://codeclimate.com/github/r7kamura/chrono) [![Coverage Status](https://coveralls.io/repos/r7kamura/chrono/badge.png?branch=master&cache-version=1)](https://coveralls.io/r/r7kamura/chrono?branch=master)

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`.

```ruby
# Trigger
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.

```ruby
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](https://github.com/r7kamura/chrono/blob/master/spec/chrono/iterator_spec.rb)
for more details.

* (*) Asterisk
* (,) Comma
* (-) Hyphen
* (/) Slash

```
* * * * *
T T T T T
| | | | `- wday --- 0 ..  6
| | | `--- month -- 1 .. 12
| | `----- day ---- 1 .. 31
| `------- hour --- 0 .. 23
`--------- minute - 0 .. 59
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chrono-0.0.3 README.md
chrono-0.0.2 README.md