Enumerable#each_slice(n)
when called with a block ({ ... }
) takes chunks of n
elements of the series and passes them to the block as arrays.
The block is an anonymous function with | a |
being the argument list. So, a
becomes the chunk on each invocation.
p
is a built-in function which outputs a presentation of its argument (a
) to stdout
.
All in all, you are seeing the chunks/slices of three elements (plus the incomplete last one) being printed.
Obviously you've found the Ruby documentation already.