Hi,
In message "Proposal: Array#to_h, to simplify hash generation"
on 03/07/19, Gavin Sinclair <gsinclair / soyabean.com.au> writes:
|If Ruby had Array#to_h, then I could rewrite it as:
|
| # return { filename -> size }
| def get_local_gz_files
| Dir["*.gz"].map { |filename|
| [ filename, File.stat(filename).size ]
| }.to_h
| end
It has been proposed several times. The issues are
* whether the name "to_h" is a good name or not. somebody came up
with the name "hashify". I'm not excited by both names.
* what if the original array is not an assoc array (array of arrays
of two elements). raise error? ignore?
matz.