array.reduce(true) { |x, y| x and y }
Useful for checking in Rails if a collection of models all have a flag set to true.
E.g.:
signers.map(&:ready?).reduce(true) { |x, y| x and y }
irb(main):021:0> [true, true].reduce(true) { |x, y| x and y }
=> true
irb(main):022:0> [true, false].reduce(true) { |x, y| x and y }
=> false
irb(main):023:0> [true, false, true].reduce(true) { |x, y| x and y }
=> false
irb(main):024:0> [true, false, true, true].reduce(true) { |x, y| x and y }
=> false
irb(main):025:0> [true, true, true, true].reduce(true) { |x, y| x and y }
=> true