From: "matz (Yukihiro Matsumoto)" Date: 2012-11-20T22:49:06+09:00 Subject: [ruby-core:49734] [ruby-trunk - Feature #4772][Rejected] Hash#add_keys Issue #4772 has been updated by matz (Yukihiro Matsumoto). Status changed from Assigned to Rejected As far as I understand, the OP intention was to generate key/default-value pair explicitly. But I don't see any real world use case. The value will be generated anyway. If he wants to cache the value, the name #add_keys does not describe the intention. So I mark this "rejected". If OP (or somebody else) come up with real use case, please re-open. Matz. ---------------------------------------- Feature #4772: Hash#add_keys https://bugs.ruby-lang.org/issues/4772#change-33304 Author: yimutang (Joey Zhou) Status: Rejected Priority: Normal Assignee: matz (Yukihiro Matsumoto) Category: Target version: next minor Hi, do you want to add a new method Hash#add_keys in a new version? hash = Hash.new {|h,k| k.to_s + "foo" } hash.add_keys("a","b","c") # the value is hash's default obj or proc value If there's a word list file, I want to make the words keys of a hash, maybe I can write: hash = {} hash.add_keys(*open("file").readlines.map(&:chomp)) -- http://bugs.ruby-lang.org/