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
That turns out to be twice as fast as the recursive method. The only
trouble I experienced was getting each_slice into my class. Turns out
that there's an error with the ruby core library documentation
produced by RDoc. #each_slice is available via the *standard* library
'enumerator.rb', not the core module library Enumerable as is
documented at
www.ruby-doc.org. Once I figured that out, all is
peachy keen.
Thanks,
Ben