Sorry --Subject was supposed to be "Need help creating hash from an array"

On 11/30/06, x1 <caldridge / gmail.com> wrote:
> What's the best way to make the first item below yield a hash instead
> of an array in one line? I'm struggling :(
>
> #doesnt work
> time = ["min", "sec"].collect {|i| {i=> Time.now.send(i).to_i}}
> puts time.type # Array
>
> #works
> time = ["min", "sec"].collect {|i| {i=> Time.now.send(i).to_i}}.first
> puts time.type # Hash
> puts time['min']
>
> Thanks in advance
>
>