From: Jeremy Henty Date: 2006-02-09T18:28:23+09:00 Subject: Re: can map/collect return fewer values than are found in the target? On 2006-02-09, Kelly Dwight Felkins wrote: > Is there a way for collect to return fewer items than the enumerable > the collect is running on? Strictly speaking, no (AFAIK), but it's easy to fake it. Use Array#collect with a block that returns nil when you don't want an element, then Array#compact the result. Similarly, to get the effect of a block returning multiple values to Array#collect, just have the block return an Array and then Array#flatten the result. Cheers, Jeremy Henty