Try Array#all?
. If arr
is an Array of booleans, this works by itself:
arr.all?
will return true
if every element in arr
is true, or false
otherwise.
You can use Array#any?
in the same manner for joining the array on ||
, that is, it returns true
if any element in the array is true and false
otherwise.
This will also work if arr
is an array of Procs
, as long as you make sure to pass the correct variables to Proc#call
in the block (or use class, instance, or global variables).