Method: Enumerable#many?
- Defined in:
- lib/passive_support/core_ext/enumerable.rb
#many?(&block) ⇒ Boolean
Returns true if the collection has more than 1 element. Functionally equivalent to collection.size > 1. Works with a block too ala any?, so people.many? { |p| p.age > 26 } # => returns true if more than 1 person is over 26.
101 102 103 104 |
# File 'lib/passive_support/core_ext/enumerable.rb', line 101 def many?(&block) size = block_given? ? select(&block).size : self.size size > 1 end |