On Thursday 05 September 2002 06:58 pm, Firestone, Mark - Technical Support wrote: > I don't understand something (so what else is new) again... lets say I have > a array with some objects in it. the object has stuff in it, thus... > > class Area_rep > > def initialize (xnum,name) > @xnum = xnum > @name = name > end > > attr_accessor :xnum, :name > > end > > I want to sort the array (with these objects in it) by xnum... > > Or is there a better, more Ruby like way to do things anyhow? ary = [Area_rep.new(1,'a'), Area_rep.new(2,'b'), Area_rep.new(3,'c')] sortedAry = ary.sort {|a, b| b.xnum <=> a.xnum} > > Thanks, > > Mark > > > NOTICE: This e-mail and any attachment(s) may contain confidential and > proprietary information of Goss International Corporation and/or its > subsidiaries and may be legally privileged. This e-mail is intended solely > for the addressee. If you are not the addressee, dissemination, copying or > other use of this e-mail or any of its content is strictly prohibited and > may be unlawful. If you are not the intended recipient please inform the > sender immediately and destroy the e-mail and any copies. All liability for > viruses is excluded to the fullest extent permitted by law. Any views > expressed in this message are those of the individual sender. No contract > may be construed by this e-mail.