From: Pit Capitain Date: 2005-01-08T15:32:55+09:00 Subject: Re: Construct [*nil] works differently in 1.6 and 1.8 Gennady Bystritksy schrieb: > In ruby 1.6 I use the following quite often to quickly convert to arrays: > > a = [ *o ] > > If 'o' is already an array, 'a' will be the same. If 'o' is non-nil, 'a' > becomes an array with 'o' as a single element. Otherwise, if 'o' is nil, > 'a' becomes an empty array. Nice and clean. > > However, in 1.8 if 'o' is nil, 'a' becomes an array with a single > element nil. Hi Gennady, you can use the method "Array": p Array( [ 1, 2, 3, ] ) p Array( "x" ) p Array( nil ) results in [1, 2, 3] ["x"] [] Regards, Pit