From: Eivind Eklund Date: 2007-11-27T22:50:06+09:00 Subject: Re: RFC - Recursive Array Method call acting on element batches On Nov 25, 2007 8:30 PM, wrote: > Thanks for your input guys. That put me on the right track. > > def proc_array(method_obj, batch_size = 2) > result = [] > self.each_slice(batch_size) do |batch| > result.concat method_obj.call(batch) > end > result > end Better: def proc_array(batch_size = 2, &method_obj) result = [] self.each_slice(batch_size) do |batch| result.concat method_obj.call(batch) end result end Can be called as ...proc_array do |batch| end or ...proc_array(2, &method_obj) Eivind.