From: Martin DeMello Date: 2003-07-21T19:40:44+09:00 Subject: Re: Proposal: Array#to_h, to simplify hash generation Gavin Sinclair wrote: > > I like "make_hash". We would get more flexibility if "make_hash" insisted > on receiving two values for the block: one for key and one for value. In > one instance recently, I wanted to map the "filename" part of a data > object to the object itself. This, I think, is readable: > > map = receipts.make_hash { |r| r.filename, r } It'd be nice if => were merely an alias for , so that we could say .make_hash {|r| r.filename => r} with two arguments, there's always the risk of confusing them. Perhaps .make_hash {|r| {r.filename => r}}, where it updates the hash with the anon hash. Inefficient, though, and it has the ugly {{ }}. > (I don't know why you put the asterix there; Ranges are Enumerable.) Yeah, I forget that from time to time. martin