From: Jeremy Henty Date: 2006-10-06T23:30:20+09:00 Subject: Re: nil being empty On 2006-10-06, David Chelimsky wrote: > ... in a case like this: > > collection.select do |item| > item.respond_to?(:empty?) and (!item.empty?) > end If the issue is simply that the collection might contain nils (rather than some more general empty? things) I would just write collection.compact.select do |item| ... end or collection.compact.select do |item| item && ... end Those examples only deal with a special case, but I've never needed to implement anything more general. YMMV Regards, Jeremy Henty