class RiCal::Component::Calendar

to see the property accessing methods for this class see the RiCal::Properties::Calendar module

Public Instance Methods

add_subcomponent(component) click to toggle source

add an event to the calendar

Calls superclass method
# File lib/ri_cal/component/calendar.rb, line 68
def add_subcomponent(component)
  super(component)
  component.add_date_times_to(required_timezones) if tz_info_source?
end
default_tzid() click to toggle source

Return the default time zone identifier for this calendar

# File lib/ri_cal/component/calendar.rb, line 52
def default_tzid
  @default_tzid || PropertyValue::DateTime.default_tzid
end
default_tzid=(value) click to toggle source

Set the default time zone identifier for this calendar To set the default to floating times use a value of :floating

# File lib/ri_cal/component/calendar.rb, line 58
def default_tzid=(value)
  @default_tzid=value
end
events() click to toggle source

return an array of event components contained within this Calendar

# File lib/ri_cal/component/calendar.rb, line 63
def events
  subcomponents["VEVENT"]
end
export(to=nil) click to toggle source

Export this calendar as an iCalendar file. if to is nil (the default) then this method will return a string, otherwise to should be an IO to which the iCalendar file contents will be written

# File lib/ri_cal/component/calendar.rb, line 230
def export(to=nil)
  export_stream = FoldingStream.new(to)
  export_stream.puts("BEGIN:VCALENDAR")
  export_properties_to(export_stream)
  export_x_properties_to(export_stream)
  export_required_timezones(export_stream)
  export_subcomponent_to(export_stream, events)
  export_subcomponent_to(export_stream, todos)
  export_subcomponent_to(export_stream, journals)
  export_subcomponent_to(export_stream, freebusys)
  subcomponents.each do |key, value|
    unless %Q{VEVENT VTODO VJOURNAL VFREEBUSYS}.include?(key)
      export_subcomponent_to(export_stream, value)
    end
  end
  export_stream.puts("END:VCALENDAR")
  if to
    nil
  else
    export_stream.string
  end
end
Also aliased as: export_to
export_to(to=nil)
Alias for: export
freebusys() click to toggle source

return an array of freebusy components contained within this Calendar

# File lib/ri_cal/component/calendar.rb, line 84
def freebusys
  subcomponents["VFREEBUSY"]
end
journals() click to toggle source

return an array of journal components contained within this Calendar

# File lib/ri_cal/component/calendar.rb, line 79
def journals
  subcomponents["VJOURNAL"]
end
timezones() click to toggle source

return an array of timezone components contained within this calendar

# File lib/ri_cal/component/calendar.rb, line 108
def timezones
  subcomponents["VTIMEZONE"]
end
todos() click to toggle source

return an array of todo components contained within this Calendar

# File lib/ri_cal/component/calendar.rb, line 74
def todos
  subcomponents["VTODO"]
end