serialize/deserialize?

15 views
Skip to first unread message

Gisborne

unread,
Nov 17, 2010, 6:32:44 PM11/17/10
to RiCal
It seems odd to me that this happens:

s = <<ENDCAL
BEGIN:VCALENDAR
X-WR-TIMEZONE:America/New_York
PRODID:-//Apple Inc.//iCal 3.0//EN
CALSCALE:GREGORIAN
X-WR-CALNAME:test
VERSION:2.0
X-WR-RELCALID:1884C7F8-BC8E-457F-94AC-297871967D5E
X-APPLE-CALENDAR-COLOR:#2CA10B
BEGIN:VTIMEZONE
TZID:US/Eastern
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
DTSTART:20070311T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
TZNAME:EDT
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
DTSTART:20071104T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
TZNAME:EST
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
SEQUENCE:5
TRANSP:OPAQUE
UID:00481E53-9258-4EA7-9F8D-947D3041A3F2
DTSTART;TZID=US/Eastern:20090224T090000
DTSTAMP:20090225T000908Z
SUMMARY:Test Event
CREATED:20090225T000839Z
DTEND;TZID=US/Eastern:20090224T100000
RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20090228T045959Z
END:VEVENT
END:VCALENDAR
ENDCAL
RiCal.parse_string(RiCal.parse_string(s).to_s)
Exception: Invalid icalendar file

The problem would seem to be that to_s wraps the original string in
square brackets. If I do:

RiCal.parse_string(RiCal.parse_string(s).to_s[1..-2])

everything is fine.

Obviously, this is trivial to do. But I feel like I'm missing
something...

Gisborne

unread,
Nov 17, 2010, 11:16:55 PM11/17/10
to RiCal
nm; I didn't notice that the parse_string returns an array. So, RTFM I
guess.
Reply all
Reply to author
Forward
0 new messages