From: Todd Benson Date: 2008-03-11T08:11:12+09:00 Subject: Re: shortcut for x = [x] unless x.is_a?(Array) On Mon, Mar 10, 2008 at 5:57 PM, Siep Korteling wrote: > Aryk Grosz wrote: > > Is there any prettier or cleaner way to write > > > > x = [x] unless x.is_a?(Array) > > x = x.to_a > > Or am I overseeing something? > > Regards, > > Siep #to_a can behave differently x = {} x = x.to_a => [x] x = {} x = [x] unless x.is_a?(Array) => [{x}] x = 5 x.to_a => some warning about default to_a being deprecated Todd