method
select
select()
public
Returns an array containing all elements of enum for which the given block returns a true value.
If no block is given, an Enumerator is returned instead.
(1..10).find_all { |i| i % 3 == 0 } #=> [3, 6, 9] [1,2,3,4,5].select { |num| num.even? } #=> [2, 4]
See also Enumerable#reject.