Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Recurring Events with Montrose

Recurring Events with Montrose

Introduction to the Montrose gem for modeling recurring events in Ruby. Learn more: http://bit.ly/1U3RDA7

Ross Kaffenberger

February 09, 2016
Tweet

More Decks by Ross Kaffenberger

Other Decks in Programming

Transcript

  1. 3

  2. INSPIRATION rfc5545 - iCAl Spec Every Friday the 13th, forever:

    RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13
  3. INTRODUCING MONTROSE “easy-to-use library for DEFINING RECURRING EVENTS IN Ruby.

    It uses a simple method chaining system…” gem install montrose
  4. r = Montrose.monthly.repeat(3) r.map(&:to_date) => [Tue, 09 Feb 2016, Wed,

    09 Mar 2016, ...] MONTROSE ENUMERABLE github.com/rossta/montrose
  5. r1 = Montrose.every(:week) r2 = Montrose.on(:tuesday, :thursday) r3 = Montrose.at("12

    pm") r1.merge(r2).merge(r3).take(4).to_a => [2016-02-09 12:00:00 -0500, 2016-02-11 12:00:00 -0500, ...] MONTROSE COMPOSABLE github.com/rossta/montrose