reject!()
public
Equivalent to Hash#delete_if, but returns nil if no changes were made.
Show source
/*
* call-seq:
* hsh.reject! {| key, value | block } -> hsh or nil
*
* Equivalent to <code>Hash#delete_if</code>, but returns
* <code>nil</code> if no changes were made.
*/
VALUE
rb_hash_reject_bang(hash)
VALUE hash;
{
int n;
RETURN_ENUMERATOR(hash, 0, 0);
n = RHASH(hash)->tbl->num_entries;
rb_hash_delete_if(hash);
if (n == RHASH(hash)->tbl->num_entries) return Qnil;
return hash;
}