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 %{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