Method: Enumerable#uniq

Defined in:
enum.c

#uniqArray #uniq {|item| ... } ⇒ Array

Returns a new array by removing duplicate values in self.

See also Array#uniq.

Overloads:



4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
# File 'enum.c', line 4167

static VALUE
enum_uniq(VALUE obj)
{
    VALUE hash, ret;
    rb_block_call_func *const func =
	rb_block_given_p() ? uniq_iter : uniq_func;

    hash = rb_obj_hide(rb_hash_new());
    rb_block_call(obj, id_each, 0, 0, func, hash);
    ret = rb_hash_values(hash);
    rb_hash_clear(hash);
    return ret;
}