fugit 1.1.0 released

I'm working on a newer version of Rufus-Scheduler, it'll probably be a 3.5.x.

Two important things behind rufus-scheduler are Time instances with time zones, this is provided by et-orbi and the parsing of time strings which is provided by fugit.

require 'fugit'

Fugit.parse('0 0 1 jan *').class         # ==> ::Fugit::Cron
Fugit.parse('12y12M').class              # ==> ::Fugit::Duration

Fugit.parse('2017-12-12').class          # ==> ::EtOrbi::EoTime
Fugit.parse('2017-12-12 UTC').class      # ==> ::EtOrbi::EoTime

Fugit.parse('every day at noon').class   # ==> ::Fugit::Cron

Fugit understands cron strings, duration strings, and points in time. They are parsed to instances of, respectively, Fugit::Cron, Fugit::Duration, and EtOrbi::EoTime (the Time instance provided by et-orbi).

The fugit cron class provides methods for determining next or previous time and if a point in time matches.

require 'fugit'

c = Fugit::Cron.parse('0 0 * *  sun')
  # or
c = Fugit::Cron.new('0 0 * *  sun')

p Time.now  # => 2017-01-03 09:53:27 +0900

p c.next_time      # => 2017-01-08 00:00:00 +0900
p c.previous_time  # => 2017-01-01 00:00:00 +0900

p c.match?(Time.parse('2017-08-06'))  # => true
p c.match?(Time.parse('2017-08-07'))  # => false
p c.match?('2017-08-06')              # => true
p c.match?('2017-08-06 12:00')        # => false

Fugit understands the standard cron format (5 entries) and also an extended format with seconds (6 entries).

The release of this 1.1.0 is a motivated by a request from the authors of que-scheduler to support cron strings with timezones.

I was busy on other (floraison) things and I had forgotten to work on cron strings with timezones. They are necessary, since rufus-scheduler understands them. Fugit has to master them to become the basis of future rufus-scheduler releases.

https://github.com/floraison/fugit