From: Julian Tarkhanov Date: 2007-09-30T00:48:54+09:00 Subject: Re: Is there a combination of a struct and an array? I wanna iterate over all created objects from a certain struct-class (I guess). On 29-sep-2007, at 15:40, kazaam wrote: > but how to achieve this? any idea or suggestion? 1) You parse the thing into a hash 2) You use a sprinkle of _why's Ruby magick to structify a hash class H < Hash def method_missing(m,*a) m.to_s=~/=$/?self[$`]=a[0]:a==[]?self[m]:super end end H[{:foo=>"bar"}].foo #=> "bar" When mixed with your task, remember that you can pass a zipped array to Hash[] (zipped means [key, val, key, val, ...]), using the splat (*). So for your person entry the example becomes: entry = text_of_a_single_person_entry H[ *entry.split("\n").map{|line| line.split(/\=/) }.flatten.map{| key_or_val | key_or_val.strip } ] -- Julian 'Julik' Tarkhanov please send all personal mail to me at julik.nl