From: Michal Zacik Date: 2011-10-19T15:57:32+09:00 Subject: Re: Custom Method not running --------------090402080700090304000606 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/19/2011 08:44 AM, Junayeed Ahnaf Nirjhor wrote: > def dictionary_sort arr > > return arr if arr.length<=1 > > middle = arr.pop > > less = arr.select{|x| x.downcase< middle.downcase} > > more = arr.select{|x| x.downcase>= middle.downcase} > > sort(less) + [middle] + sort(more) > > end > > words = ['can','feel','singing.','like','A','can'] > > puts(dictionary_sort(words).join(' ')) Hi, sort is Array method: def dictionary_sort arr return arr if arr.length<=1 middle = arr.pop less = arr.select{|x| x.downcase< middle.downcase} more = arr.select{|x| x.downcase>= middle.downcase} less.sort + [middle] + more.sort end Michal --------------090402080700090304000606--