From: Trans Date: 2005-04-09T12:39:38+09:00 Subject: Re: help traversing and modifying hash key and value inplace Thanks Robert. I agree about returning self. Since dup can't be used when the object is immutable (that's the condition isn't it?) then it would seem reasonable to return self. I'm not sure what recursive structures you mean. And I don't see how it could work if the duping is left to the block. How could a new hash be built up then? Hmm... perhaps it would work better if a hash parameter were fed into the block itself and then that could be used? h = h.traverse { |n,k,v| n[k.downcase] = v } Would that a better approach? BTW, somone sent me another version similar to my original, but using inject and somehow getting around the dup problem like so: def traverse(&b) inject({}) do |h,kv| k,v = kv.first.dup, kv.last.dup b[k,v] h[k] = (Hash === v ? v.traverse(&b) : v) h end end T.