« Return to Thread: Help required on sorting

Re: Help required on sorting

by Dipti Iyengar :: Rate this Message:

Reply to Author | View in Thread

David A. Black wrote:

> Hi --
>
> On Thu, 9 Jul 2009, Dipti Iyengar wrote:
>
>> Any quicker way to do this?
> You could do:
>
>    LEVELS = %w{ High Medium Low Info Safe }
>
>    sorted = risks.sort_by {|r| LEVELS.index(r.capitalize) }
>
>
> David

Thanks a lot Bertram .... Worked like a charm....
Thanks a lot David...didn't try the solution as yet :)
--
Posted via http://www.ruby-forum.com/.

 « Return to Thread: Help required on sorting