Flowdock
method

enum_slice

Importance_2
Ruby latest stable (v2_5_5) - 1 note - Class: Enumerable

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.

enum_slice(p1) public

Iterates the given block for each slice of <n> elements. If no block is given, returns an enumerator.

e.g.:

(1..10).each_slice(3) {|a| p a}
# outputs below
[1, 2, 3]
[4, 5, 6]
[7, 8, 9]
[10]
Show source
Register or log in to add new notes.
August 23, 2008
0 thanks

Needs requiring 'enumerator' to work

This method needs that you

require 'enumerator'

for this method to be available.