/* * call-seq: * enum.all? [{|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>false</code> or <code>nil</code>. If the block is not given, * Ruby adds an implicit block of <code>{|obj| obj}</code> (that is * <code>all?</code> will return <code>true</code> only if none of the * collection members are <code>false</code> or <code>nil</code>.) * * %w{ ant bear cat}.all? {|word| word.length >= 3} #=> true * %w{ ant bear cat}.all? {|word| word.length >= 4} #=> false * [ nil, true, 99 ].all? #=> false * */ static VALUE enum_all(obj) VALUE obj; { VALUE result = Qtrue; rb_iterate(rb_each, obj, rb_block_given_p() ? all_iter_i : all_i, (VALUE)&result); return result; }