none?()
public
Passes each element of the collection to the given block. The method
returns true if the block never returns true for all elements. If the block
is not given, none? will return true
only if none of the collection members is true.
%w{ant bear cat}.none? {|word| word.length == 5}
%w{ant bear cat}.none? {|word| word.length >= 4}
[].none?
[nil].none?
[nil,false].none?
Show source
/*
* call-seq:
* enum.none? [{|obj| block }] => true or false
*
* Passes each element of the collection to the given block. The method
* returns <code>true</code> if the block never returns <code>true</code>
* for all elements. If the block is not given, <code>none?</code> will return
* <code>true</code> only if none of the collection members is true.
*
* %w{ant bear cat}.none? {|word| word.length == 5} #=> true
* %w{ant bear cat}.none? {|word| word.length >= 4} #=> false
* [].none? #=> true
* [nil].none? #=> true
* [nil,false].none? #=> true
*/
static VALUE
enum_none(obj)
VALUE obj;
{
VALUE result = Qtrue;
rb_block_call(obj, id_each, 0, 0, rb_block_given_p() ? none_iter_i : none_i, (VALUE)&result);
return result;
}