Sha256: 67ab28b09185848905ca38e4d2fe8f78f4d5f2fdbdc09d23c8f05f2b8627b1aa
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
## Need this so we can require the library from the samples directory $:.unshift(File.dirname(__FILE__) + '/../../lib') require 'icalendar' require 'date' # Create a calendar with a single event (Method 1) cal = Icalendar::Calendar.new event = Icalendar::Event.new # Set some properties for this event event.user_id = "joe-bob@somewhere.net" event.timestamp = DateTime.now event.start = Date.new(2005, 04, 29) event.end = Date.new(2005, 04, 28) event.summary = "Meeting with the man." event.klass = "PRIVATE" # Now add it to the calendar cal.add event # Create a calendar with a single event (Method 2) cal2 = Icalendar::Calendar.new event = cal.event # This automatically adds the event to the calendar event.user_id = "joe-bob@somewhere.net" event.timestamp = DateTime.now # Create a calendar with a single event (Method 3) cal3 = Icalendar::Calendar.new cal3.event do user_id "joe-bob@somewhere.net" event.timestamp DateTime.now end # We can output the calendars as strings to write to a file, # network port, database etc. cal_string = cal.to_ical puts cal_string #:startdoc:
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
icalendar-0.95 | docs/examples/create_cal.rb |
icalendar-0.96 | docs/examples/create_cal.rb |