David Alan Black <dblack / candle.superlink.net> writes: > class Array > def to_h > h = {} > each_index { |i| h[i] = at i } > h > end > end > > %w{ list of words }.to_h # => {0=>"list", 1=>"of", 2=>"words"} > > One could then invert the hash to get at least one version of the > original effect -- namely, the original array elements as hash keys > and all the values true. (Even zero!) I'm convinced by this, particular if we added the block form too. Regards Dave