0.0
No commit activity in last 3 years
No release in over 3 years
extends ice_cube to handle more rules, check homepage for more details
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

IceCubeEx

Gem Version build Code Climate Test Coverage Dependency Status

Extends gem ice_cube to handle custom rules, outside of the iCalendar spec.

Installation

First require ice_cube, and then require ice_cube_ex, by adding the following line to your application's Gemfile:

gem 'ice_cube'
gem 'ice_cube_ex'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ice_cube_ex

Usage

ice_cube_ex has new rules that can be used with ice_cube's schedules:

DayCycleRule

This rule allows to specify a number of days, which indicates a cycle, and another number of days to skip inside that cycle. For example, we want an event that starts at 2015-1-1 to recur every 5 days while skipping the last 3 days, we would do something like this:

schedule = IceCube::Schedule.new(Time.new(2015, 1, 1)) do |s|
  s.rrule IceCubeEx::Rule.day_cycle(5, 3)
end

Now try calculating next occurrences:

occurrence_time = schedule.next_occurrence(Time.new(2014-12-30))
# returns 2015-1-1

occurrence_time = schedule.next_occurrence(occurrence_time)
# returns 2015-1-2

occurrence_time = schedule.next_occurrence(occurrence_time)
# returns 2015-1-3

occurrence_time = schedule.next_occurrence(occurrence_time)
# returns 2015-1-6

occurrence_time = schedule.next_occurrence(occurrence_time)
# returns 2015-1-7

occurrence_time = schedule.next_occurrence(occurrence_time)
# returns 2015-1-8

You can also use count and until to limit your rule as you would normally do with a regular ice_cube rule.

Contributing

  1. Fork it ( https://github.com/junhanamaki/ice_cube_ex/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request