On 24 Jul 2010, at 4:16 PM, Dave Spurr wrote:
> properties = [:a,:b,:c]
> attributes = {}
> properties.each_with_index {|p,i| attributes[p] = i + 1}
>
> puts attributes.inspect
Aye, that works too, but replaces the enumerator with a local hash variable. I
guess what I want is #inject_with_index...
Cheers
Ash
--
http://www.patchspace.co.uk/
http://www.linkedin.com/in/ashleymoran
--
You received this message because you are subscribed to the Google Groups
"NWRUG" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nwrug-members?hl=en.