From: Yukihiro Matsumoto Date: 2005-04-02T11:11:19+09:00 Subject: Re: Two Questions about Hash Defaults Hi, In message "Re: Two Questions about Hash Defaults" on Sat, 2 Apr 2005 10:28:12 +0900, Pete Elmore writes: | |I have a couple of questions about hashes. The first is fairly simple: |is there a way to set a default so that when the value for a key is |changed, the object it points to is default.dup instead of default? list = Hash.new{[]} |The second question is about setting defaults from one hash based on |another. This question is more along the lines of 'Does this code |violate Ruby sensibilities?' defaults = { :preserve_breaks => true, :indent => 0, :columns => 79, } list = Hash.new{|h,k|defaults[k]}