From: Yukihiro Matsumoto Date: 2011-05-25T01:30:18+09:00 Subject: [ruby-core:36432] [Ruby 1.9 - Feature #4772] Hash#add_keys Issue #4772 has been updated by Yukihiro Matsumoto. I see no reason to add a method to generate keys only. Hash is a set of key-value pairs, right? Can you elaborate why you want this method? matz. ---------------------------------------- Feature #4772: Hash#add_keys http://redmine.ruby-lang.org/issues/4772 Author: Joey Zhou Status: Open Priority: Normal Assignee: Category: Target version: 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://redmine.ruby-lang.org