From: Jim Freeze Date: 2002-01-17T04:29:23+09:00 Subject: Re: Protecting a member hash On Thu, Jan 17, 2002 at 03:59:00AM +0900, Jack Dempsey wrote: > I don't understand how he was able to write to the hash with only an > attr_reader in place...what am I overlooking? > The t.entity returns the hash. Once I have it in my possesion, I can do whatever I want. :) It's like doing: #t.entity[key] = val in 2 step: my_hash_ptr = t.entity my_hash_ptr[key] = val So, I could merrily change all of its contents. However, Ruby will complain if I try to do: t.entity = someting_else This attempts to change the value of @entity, not it contents. Jim -- Jim Freeze Today is a fine day for Ruby programming. www.freeze.org