RiCal is a new Ruby Library for parsing, generating, and using iCalendar (RFC 2445) format data.
sudo gem install ri_cal
RiCal distinguishes itself from existing Ruby libraries in providing support for
- Timezone components in Calendars. This means that RiCal parses VTIMEZONE data and instantiates timezone objects
which can be used to convert times in the calendar to and from UTC time. In addition, RiCal allows created calendars
and components to use time zones understood by TZInfo gem (from either the TZInfo gem or from Rails ActiveSupport => 2.2).
When a calendar with TZInfo time zones is exported, RFC 2445 conforming VTIMEZONE components will be included, allowing
other programs to process the result.
- Enumeration of recurring occurrences. For example, if an Event has one or more recurrence rules, then the occurrences
of the event can be enumerated as a series of Event occurrences.
Demonstration of usage
RiCal provides a builder DSL for creating calendars and calendar components. An exampleRiCal.Calendar do event do description “MA-6 First US Manned Spaceflight” dtstart DateTime.parse(“2/20/1962 14:47:39”) dtend DateTime.parse(“2/20/1962 19:43:02”) location “Cape Canaveral” add_attendee “firstname.lastname@example.org” alarm do description “Segment 51” end end end
The blocks are evaluated in the context of an object which builds the calendar or calendar component. method names
starting with add_ or remove_ are sent to the component, method names which correspond to a property value setter of
the object being built will cause that setter to be sent to the component with the provided value.
A method corresponding to the name of one of the components sub component will create the sub component and
evaluate the block in the context of the new subcomponent.
How to submit patches
The current development version of RiCal is always maintained on github. The official release here on RubyForge will be updated periodically as warranted.
I would prefer patches which include a spec which fails before the patch is applied and passes after. The best way to submit a patch is via the lighthouse bug tracking system
Get the latest version from github
git clone git://rubyforge.org/ri_cal.git
Alternatively fork the rical project and create your own github version.
I would prefer that you submit patches as attachments to lighthouse tickets created using git format-patch
Build and test instructions
RiCal requires either the tzinfo gem, or a version (=< 2.2) of the activesupport gem (part of Rails). To allow users of RiCal to control their own dependencies RiCal itself does not declare these as gem dependencies.
You will need to install either the tzinfo gem, or the activesupport gem or both.
There are two rake tasks for running the specs
runs the specs after requiring the tzinfo gem. Similarly
runs the specs after requiring activesupport.
The default rake task runs both of these.
This code is free to use under the terms of the MIT license.
Comments are welcome. Send an email to Rick DeNatale