From: Todd Benson Date: 2008-02-19T02:14:10+09:00 Subject: Re: where to check for nils or empty? On Feb 18, 2008 11:05 AM, Todd Benson wrote: > On Feb 16, 2008 4:24 PM, Christopher Dicely wrote: > > Maybe something like this? > > > > class Whatever > > def initialize > > ... > > @reviews = [:firstReview, :secondReview, ...] > > end > > > > def process array > > @reviews.inject(array) do |arr, review| > > break if arr.nil? || arr.empty? > > send(review, arr) > > end > > end > > You could also build the original array beforehand... > > (array - [[]]).compact Also, depending on your data, you might have to do it backwards... array.compact - [[]] Todd