How to split (chunk) a Ruby array into parts of X elements? [duplicate]
This question already has answers here: How to chunk an array in Ruby (2 answers) Closed 4 years ago. I have an array foo = %w(1 2 3 4 5 6 7 8 9 10) How can I split or “chunk” this into smaller arrays? class Array def chunk(size) # return array of arrays end … Read more