From: Alan Chen Date: 2003-03-16T05:18:25+09:00 Subject: Re: ANN: vcard 0.1 - a vCard decoding library Well, you could always return an array. puts card[:email] #=> [ rich@infoether.com ] On Sun, Mar 16, 2003 at 05:05:34AM +0900, Sam Roberts wrote: > Quoteing rich@infoether.com, on Sun, Mar 16, 2003 at 04:15:57AM +0900: > > One quick recommendation is to use the index method [] as an alias for > > value_of on the VCard object...that way you could do this: > > > > VCDATA =< > BEGIN:VCARD > > VERSION:3.0 > > N:Kilmer;Rich;;; > > FN:Kilmer Rich > > EMAIL;type=HOME:rich@monotheos.com > > EMAIL;type=WORK;type=pref:rich@infoether.com > > END:VCARD > > END > > > > card = Rfc2425::VCard.new(VCDATA) > > puts card["email"] #=> rich@infoether.com > > I thought about it, but didn't because I ran into the "which one do I > return, there can be multiple fields with that name" problem. > > I just looked at RFC2426 in more detail, though, and it appears that > type=pref is allowed for a lot of things that can have multiple > occurences. -- Alan Chen Digikata Computing http://digikata.com