Method: Enumerable#partition

Defined in:
enum.c

#partition {|obj| ... } ⇒ Array

Returns two arrays, the first containing the elements of enum for which the block evaluates to true, the second containing the rest.

(1..6).partition {|i| (i&1).zero?}   #=> [[2, 4, 6], [1, 3, 5]]

Yields:

  • (obj)

Returns:



340
341
342
# File 'enum.c', line 340

static VALUE
enum_partition(obj)
VALUE obj;