From: Adam Prescott Date: 2011-05-25T18:28:55+09:00 Subject: [ruby-core:36453] Re: [Ruby 1.9 - Feature #4772][Open] Hash#add_keys --90e6ba6e8d584be40604a41655ba Content-Type: text/plain; charset=UTF-8 On Tue, May 24, 2011 at 9:36 AM, Joey Zhou wrote: > 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 default proc, I can't see why you'd need to create the keys like this. If you did want to, can you not just use keys.each { |k| hash[keys] } ? For instance: open("file").readlines.map(&:chomp).each { |k| hash[k] } --90e6ba6e8d584be40604a41655ba Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
If t= here's a default proc, I can't see why you'd need to create the= keys like this. If you did want to, can you not just use

keys.each { |k| hash[keys] }

?=

For instance:

open("file&= quot;).readlines.map(&:chomp).each { |k| hash[k] }
--90e6ba6e8d584be40604a41655ba--