Ruby on Rails – Easier enumerations (Select, Collect, Map) using Ampersand
a = [] # setup array 0.upto(100) do #just make up some array a << rand(1000) end s = a.in_groups_of(6,false) # make it an array of arrays (so we can use the sort method on each element of the outer array) s.collect(&:sort) #sort each array inside the outer array in one easy step What are […]
Posted on March 31, 2009 at 10:31 am by Jordan Carter · Permalink
· One Comment
In: Uncategorized · Tagged with: arrays, collections, enumerations, Rails, Ruby
In: Uncategorized · Tagged with: arrays, collections, enumerations, Rails, Ruby