== About ice_cube
ice_cube is a time recurrence library for Ruby. The API is modeled
after iCalendar repeating events, making it very easy to describe
complex rules and conjunctions in pure Ruby. ice_cube's power lies in
its ability to specify multiple rules - and easily query and expand
them. Most importantly, ice_cube is fast, extremely expressive, and
removes ugly complex date logic from your application.
== Example
Rule.yearly.day(:friday).day_of_month(13).month_of_year(:october)
Hi John.
I like this library, it was just what I wanted.
I am a newbie, i did not understand how to put dynamically the numbers
of the days in the method IceCube::Rule.weekly
This is a great gem, and probably the best starting point I could have
hoped for in order to meet my project's requirements - thanks a
million for putting it together!
I'm dealing with recurring events which can be both stuff like normal
business hours (mon-fri 10-18 & sat 12-18) or more obscure ones
(second sunday of every month 12-19). I've set up a simple model and
associated form which generates rules for the starting times, and it
all works very nicely indeed (I render the schedule to YAML before
storing in DB). But then *doh* it hits me: there is no way to specify
an end time other than the time when the recurring series as a whole
should end. How do I go about giving each recurring event a time
span?
Many thanks for your quick reply! I knew about the .until() option,
but it's not quite what I was after though. From the readme:
"Individual rules may optionally specify an until date, which is a
date that that individual rule is no longer effective". I need the
rule to remain effective for the next occurrence of the event. Think
of it this way: what if I have a weekly meeting every Monday between
9.30am and 10.30am and I do .occurs_at?(Time.now) on a Monday @ 10am?
What I'm after is a way to specify the duration of each occurrence,
but perhaps I'm better off storing this separately? But then how to
deal with a schedule with multiple rules (where each rule might have a
different duration)?
Yep, since ice_cube is made for occurrences and not durations - you'd
have to store these separately. I'm working with a branch now that
will support end_times for rules, so you could call occurring_at?
(Time.now) on a rule and see if it occurs anywhere in the duration.
I'll have this ready in the next few days
Thanks,
John C
That is awesome news John, I am sure this will become a hugely popular
gem - it's almost a complete calendaring system in a box! I wish my
skills were up to a level where I could offer to help, but I fear I'd
just mess things up for you :s Please know that your efforts are
greatly appreciated!
I'm just having a look at this, as I've another need for
recurrence-tracking. Previously I've used RiCal, but liked the look of
IceCube as a little more lightweight.
But I'm getting lots of error in my console with Dates being compared
to Times, or missing "utc_offset" method.... have I missed something
in the requirements for Ruby or Rails for this gem?
I'm on Ruby 1.8.7 and Rails 2.3.2 (for this project).