Craig White
2008-Feb-11 21:10 UTC
[iCalendar-devel] getting at some of the attributes in my array...
I unpacked the gem so I could make some alterations to the attributes... array that looks something like this... @events[0].properties.inspect "{\"sequence\"=>0, \"rrule\"=>[\"FREQ=YEARLY;INTERVAL=1;UNTIL=99991231 \"], \"organizer\"=>#<URI::MailTo:0xfdbbdc850 URL:MAILTO:admin_user at tobyhouse.com>, \"dtend\"=>#<DateTime: 4908935/2,0,2299161>, \"uid \"=>\"20071218103913.p5z6eezmz0g at srv1.tobyhouse.com\", \"description \"=>\"Contact Coyote Fire to schedule\", \"summary\"=>\"Bethany Fire Extinguisher Inspection Due\", \"dtstart\"=>#<DateTime: 4908933/2,0,2299161>, \"attendee\"=>[#<URI::MailTo:0xfdbbda712 URL:MAILTO:someone at tobyhouse.com>, #<URI::MailTo:0xfdbbd981c URL:MAILTO:another_someone at tobyhouse.com>], \"transp\"=>\"OPAQUE\", \"dtstamp\"=>#<DateTime: 212069522089/86400,0,2299161>, \"location \"=>\"Bethany\"}" no problem here... @events[0].location => "Bethany" or here... @events[0].uid => "20071218103913.p5z6eezmz0g at srv1.tobyhouse.com" but this is a problem... @events[0].rrule NoMethodError: Method Name: rrule from ./script/../config/../config/../vendor/gems/icalendar/lib/icalendar/component.rb:413:in `method_missing'' from (irb):116 from :0 How can I fix this? Craig
Craig White
2008-Feb-27 22:34 UTC
[iCalendar-devel] getting at some of the attributes in my array...
On Mon, 2008-02-11 at 14:10 -0700, Craig White wrote:> I unpacked the gem so I could make some alterations to the attributes... > > array that looks something like this... > > @events[0].properties.inspect > "{\"sequence\"=>0, \"rrule\"=>[\"FREQ=YEARLY;INTERVAL=1;UNTIL=99991231 > \"], \"organizer\"=>#<URI::MailTo:0xfdbbdc850 > URL:MAILTO:admin_user at tobyhouse.com>, \"dtend\"=>#<DateTime: > 4908935/2,0,2299161>, \"uid > \"=>\"20071218103913.p5z6eezmz0g at srv1.tobyhouse.com\", \"description > \"=>\"Contact Coyote Fire to schedule\", \"summary\"=>\"Bethany Fire > Extinguisher Inspection Due\", \"dtstart\"=>#<DateTime: > 4908933/2,0,2299161>, \"attendee\"=>[#<URI::MailTo:0xfdbbda712 > URL:MAILTO:someone at tobyhouse.com>, #<URI::MailTo:0xfdbbd981c > URL:MAILTO:another_someone at tobyhouse.com>], \"transp\"=>\"OPAQUE\", > \"dtstamp\"=>#<DateTime: 212069522089/86400,0,2299161>, \"location > \"=>\"Bethany\"}" > > no problem here... > @events[0].location > => "Bethany" > > or here... > @events[0].uid > => "20071218103913.p5z6eezmz0g at srv1.tobyhouse.com" > > but this is a problem... > @events[0].rrule > NoMethodError: Method Name: rrule > > from ./script/../config/../config/../vendor/gems/icalendar/lib/icalendar/component.rb:413:in `method_missing'' > from (irb):116 > from :0 > > How can I fix this?---- well, I solved it but I''m not sure why but using @events[0].recurrence_rules was valid so in light of no responses from anyone and in case someone follows in my footsteps, this might be useful. Craig
Jeff Rose
2008-Feb-28 10:13 UTC
[iCalendar-devel] getting at some of the attributes in my array...
Hi Craig, This same type of question has come up a number of times in the mailing list, which probably means I should improve the examples and docs. Recurrence rules are one of a number of properties that can have multiple instances within an event. For these multiple instance properties there are plural methods that return arrays, and then there are singular methods to add and remove instances. If you take a look at lib/icalendar/components/event.rb you will see the definition list of all the valid properties, along with their plurality. If I were creating this API to build calendars without having to follow a specification it would work differently for a number of things, but since the goal is compatibility we are stuck with some oddity. That said, if you have ideas on how to make things cleaner I''m all ears (and very willing to accept patches :-). -Jeff Craig White wrote:> On Mon, 2008-02-11 at 14:10 -0700, Craig White wrote: >> I unpacked the gem so I could make some alterations to the attributes... >> >> array that looks something like this... >> >> @events[0].properties.inspect >> "{\"sequence\"=>0, \"rrule\"=>[\"FREQ=YEARLY;INTERVAL=1;UNTIL=99991231 >> \"], \"organizer\"=>#<URI::MailTo:0xfdbbdc850 >> URL:MAILTO:admin_user at tobyhouse.com>, \"dtend\"=>#<DateTime: >> 4908935/2,0,2299161>, \"uid >> \"=>\"20071218103913.p5z6eezmz0g at srv1.tobyhouse.com\", \"description >> \"=>\"Contact Coyote Fire to schedule\", \"summary\"=>\"Bethany Fire >> Extinguisher Inspection Due\", \"dtstart\"=>#<DateTime: >> 4908933/2,0,2299161>, \"attendee\"=>[#<URI::MailTo:0xfdbbda712 >> URL:MAILTO:someone at tobyhouse.com>, #<URI::MailTo:0xfdbbd981c >> URL:MAILTO:another_someone at tobyhouse.com>], \"transp\"=>\"OPAQUE\", >> \"dtstamp\"=>#<DateTime: 212069522089/86400,0,2299161>, \"location >> \"=>\"Bethany\"}" >> >> no problem here... >> @events[0].location >> => "Bethany" >> >> or here... >> @events[0].uid >> => "20071218103913.p5z6eezmz0g at srv1.tobyhouse.com" >> >> but this is a problem... >> @events[0].rrule >> NoMethodError: Method Name: rrule >> >> from ./script/../config/../config/../vendor/gems/icalendar/lib/icalendar/component.rb:413:in `method_missing'' >> from (irb):116 >> from :0 >> >> How can I fix this? > ---- > well, I solved it but I''m not sure why but using > @events[0].recurrence_rules was valid > > so in light of no responses from anyone and in case someone follows in > my footsteps, this might be useful. > > Craig > > _______________________________________________ > icalendar-devel mailing list > icalendar-devel at rubyforge.org > http://rubyforge.org/mailman/listinfo/icalendar-devel
Craig White
2008-Feb-28 15:58 UTC
[iCalendar-devel] getting at some of the attributes in my array...
Jeff, I don''t really have ideas but thanks for all your efforts. I understand the point you are making and am not intending to be critical beyond my lack of understanding how to deal. In this case, it seemed clear that the attributes coming from my ical file used rrule but iCalendar uses some kind of secret decoder ring to correlate recurrence_rules to rrule. I suspect that much of my frustration was that I have been trying to go the opposite way...trying to parse ical files INTO ruby as opposed to creating ical files FROM ruby. As I said, I think I am more hamstrung by my lack of ruby skills and my severe lack of understanding the concept of calendars and ical files. Thanks Craig On Thu, 2008-02-28 at 11:13 +0100, Jeff Rose wrote:> Hi Craig, > This same type of question has come up a number of times in the > mailing list, which probably means I should improve the examples and > docs. Recurrence rules are one of a number of properties that can have > multiple instances within an event. For these multiple instance > properties there are plural methods that return arrays, and then there > are singular methods to add and remove instances. If you take a look at > lib/icalendar/components/event.rb you will see the definition list of > all the valid properties, along with their plurality. > > If I were creating this API to build calendars without having to follow > a specification it would work differently for a number of things, but > since the goal is compatibility we are stuck with some oddity. That > said, if you have ideas on how to make things cleaner I''m all ears (and > very willing to accept patches :-). > > -Jeff > > Craig White wrote: > > On Mon, 2008-02-11 at 14:10 -0700, Craig White wrote: > >> I unpacked the gem so I could make some alterations to the attributes... > >> > >> array that looks something like this... > >> > >> @events[0].properties.inspect > >> "{\"sequence\"=>0, \"rrule\"=>[\"FREQ=YEARLY;INTERVAL=1;UNTIL=99991231 > >> \"], \"organizer\"=>#<URI::MailTo:0xfdbbdc850 > >> URL:MAILTO:admin_user at tobyhouse.com>, \"dtend\"=>#<DateTime: > >> 4908935/2,0,2299161>, \"uid > >> \"=>\"20071218103913.p5z6eezmz0g at srv1.tobyhouse.com\", \"description > >> \"=>\"Contact Coyote Fire to schedule\", \"summary\"=>\"Bethany Fire > >> Extinguisher Inspection Due\", \"dtstart\"=>#<DateTime: > >> 4908933/2,0,2299161>, \"attendee\"=>[#<URI::MailTo:0xfdbbda712 > >> URL:MAILTO:someone at tobyhouse.com>, #<URI::MailTo:0xfdbbd981c > >> URL:MAILTO:another_someone at tobyhouse.com>], \"transp\"=>\"OPAQUE\", > >> \"dtstamp\"=>#<DateTime: 212069522089/86400,0,2299161>, \"location > >> \"=>\"Bethany\"}" > >> > >> no problem here... > >> @events[0].location > >> => "Bethany" > >> > >> or here... > >> @events[0].uid > >> => "20071218103913.p5z6eezmz0g at srv1.tobyhouse.com" > >> > >> but this is a problem... > >> @events[0].rrule > >> NoMethodError: Method Name: rrule > >> > >> from ./script/../config/../config/../vendor/gems/icalendar/lib/icalendar/component.rb:413:in `method_missing'' > >> from (irb):116 > >> from :0 > >> > >> How can I fix this? > > ---- > > well, I solved it but I''m not sure why but using > > @events[0].recurrence_rules was valid > > > > so in light of no responses from anyone and in case someone follows in > > my footsteps, this might be useful. > > > > Craig