From: "Iñaki Baz Castillo" Date: 2008-06-27T07:15:47+09:00 Subject: Ruby way to find in an Array the object with a maximun in an attribute? Hi, I've an Array of objects containing some attributes: class SRV - @priority - @domain - @port end In the Array I have 3 SRV objects: Array[0] - @priority = 1 - @domain = mydomain.com - @port = 5060 Array[1] - @priority = 0 - @domain = mydomain2.net - @port = 5060 Array[2] - @priority = 0 - @domain = mydomain3.org - @port = 5070 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. -- Iñaki Baz Castillo