struct.select {|i| block } â array
struct.select â an_enumerator
struct.select â an_enumerator
Instance Public methods
Invokes the block passing in successive elements from struct,
returning an array containing those elements for which the block returns a
true value (equivalent to Enumerable#select
).
1 2 3 | Lots = Struct. new ( :a , :b , :c , :d , :e , :f ) l = Lots. new ( 11 , 22 , 33 , 44 , 55 , 66 ) l.select {|v| (v % 2 ).zero? } #=> [22, 44, 66] |
Please login to continue.