From: Stefan Rusterholz Date: 2007-07-13T04:24:20+09:00 Subject: Re: Returning part of a hash Trans wrote: > def &(other) > case other > when Array > k = (keys & other) > Hash[*(k.zip(values_at(*k)).flatten)] > else > Hash.new[*(to_a & other.to_a).flatten] > end > end > > end > > T. > > --- > http://facets.rubyforge.org Hash[*something.flatten] will destroy any nested arrays (and if you're so unlucky to get an even amount of elements, it won't even raise). Regards Stefan -- Posted via http://www.ruby-forum.com/.