[ruby-talk:02366] Re: setter() for local variables

From: matz@... (Yukihiro Matsumoto)
Date: 2000-04-05 15:01:51 UTC
List: ruby-talk #2366
Hi,

In message "[ruby-talk:02358] Re: setter() for local variables"
    on 00/04/04, ts <decoux@moulon.inra.fr> writes:

| I just need to write this, no ?

Hmm,

| db[1] will return a new object Toto.
|
| Only the current object is duplicated (i.e. in memory and in the db file)
| and not the whole db.

You can protect the object modification through toto object, but you
have to notice modification through direct reference to the original
object is still not checked.

| In this case, do I need to destroy all methods in the class Toto, to have
| only method_missing ?

Yes, look at lib/delegate.rb for example of forwarding.

							matz.

In This Thread

Prev Next