method
enum_slice
v1_8_7_330 -
Show latest stable
-
1 note -
Class: Enumerable
- 1_8_6_287 (0)
- 1_8_7_72 (27)
- 1_8_7_330 (0)
- 1_9_1_378
- 1_9_2_180
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
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]
Register or
log in
to add new notes.
yonosoytu -
August 23, 2008
0 thanks
Needs requiring 'enumerator' to work
This method needs that you
require 'enumerator'
for this method to be available.