public Method

Enumerable.reject

enum.reject {| obj | block }   array

Returns an array for all elements of enum for which block is false (see also Enumerable#find_all).

(1..10).reject {|i|  i % 3 == 0 }   #=> [1, 2, 4, 5, 7, 8, 10]

Source Code

/*
*  call-seq:
*     enum.reject {| obj | block }  => array
*  
*  Returns an array for all elements of <i>enum</i> for which
*  <em>block</em> is false (see also <code>Enumerable#find_all</code>).
*     
*     (1..10).reject {|i|  i % 3 == 0 }   #=> [1, 2, 4, 5, 7, 8, 10]
*     
*/

static VALUE
enum_reject(obj)
   VALUE obj;
{
   VALUE ary = rb_ary_new();

   rb_iterate(rb_each, obj, reject_i, ary);

   return ary;
}
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.