From: Ben Bleything Date: 2007-08-03T00:11:48+09:00 Subject: Re: Private methods not so private? On Thu, Aug 02, 2007, Dan Zwell wrote: > Ben Bleything wrote: > >Yes. send bypasses protection levels, for reasons I'm not really clear > >on. If I were to hazard a guess, it would be that what you send is > >eval'ed inside the context of the object, thereby making self the > >receiver, but that's a total guess. > > It is always possible to run private methods, change class variables, > etc. The way to do it is to reopen the class (or add an instance method) > that calls the private method or sets/gets the variable we need. Since > it's possible, why not make it easier? Ruby tries not to impose on what > the user can do, so we have foo.send, foo.instance_variable_set, and > foo.instance_variable_get. Right. I was just trying to answer the original question :) Ben