From: x1 Date: 2006-10-14T08:13:13+09:00 Subject: Re: Sorting through an array of an array container.sort_by {|x| x[2]} On 10/13/06, Dominic Son wrote: > But how to do apply this to having 3 elements in the value of an array? > > container.sort_by { |x,y,z| *lost here* > puts x
> puts y
> puts z
> } > > Brian Mitchell wrote: > > On 10/13/06, Dominic Son wrote: > >> What method should i use? > > Actually, the better way to sort in this scenario is to use sort_by. > > > > container.sort_by {|x| x[1]} > > > > No need to mess with the <=> operator by hand. > > > > Brian. > > > -- > Posted via http://www.ruby-forum.com/. > >