Module: Enumerable

Defined in:
lib/source/ruby.rb

Overview

Enumerable

Instance Method Summary collapse

Instance Method Details

#all?(block = `function(obj){return $T(obj);}`) ⇒ Boolean

call-seq:

enum.all? [{ |obj| block }] -> true or false

Passes each element of the collection to the given block. The method returns true if the block never returns false or nil. If the block is not given, Red adds an implicit block of {|obj| obj } (that is, all? will return true only if none of the collection members are false or nil.)

%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

Returns:

  • (Boolean)


1298
1299
# File 'lib/source/ruby.rb', line 1298

def all?(block = `function(obj){return $T(obj);}`)
end