From: "Iñaki Baz Castillo" Date: 2008-06-27T07:33:17+09:00 Subject: Re: Ruby way to find in an Array the object with a maximun in an attribute? [SOLVED] El Viernes, 27 de Junio de 2008, Iñaki Baz Castillo escribió: > And I need to get an array containing the Array elements with smallest > @priority value, this is: > > ResultArray[0] > - @priority = 0 > - @domain = mydomain2.net > - @port = 5060 > > ResultArray[1] > - @priority = 0 > - @domain = mydomain3.org > - @port = 5070 > > > Which is the best way to get the final array? Thanks for any suggestion. Done :) Array.sort! { |a,b| (a.priority <=> b.priority) } -- Iñaki Baz Castillo