Read my latest article: 8 things I look for in a Ruby on Rails app (posted Thu, 06 Jul 2017 17:59:00 GMT)

CollectionClosureMethod

Posted by Tue, 13 Sep 2005 23:40:00 GMT

Last month, Martin Fowler posted an entry on his bliki that discussed the CollectionClosureMethod. He showed examples in Smalltalk, Lisp, and… Ruby!. It’s worth the read and he updates his bliki fairly regularly-so, I would suggest that you add his RSS feed to your RSS reader. :)

sortedEmployees = employees.sort {|a,b| a.lastname <=> b.lastname}

Enjoy!