On Mon, 20 Nov 2006 15:33:33 -0000, David Lelong <drlelon / yahoo.com> wrote: > Hi, > > I have a hash that contains the following keys/values: > > [#<Contact_List:0x2607150 @attributes={"contact_id"=>"4"}>, > #<Contact_List:0x2607114 @attributes={"contact_id"=>"8"}>] > > I want to create an array containing the contact_id values. What's an > easy way to do this? > > Thanks, > > David > Assuming Contact_List (aside: why an underscored class name?) has an attr_accessor for 'attributes', you might try: a.map { |clist| clist.attributes['contact_id'] } (where 'a' is the array you show above). -- Ross Bamford - rosco / roscopeco.remove.co.uk