On Wed, 24 Oct 2001, David Alan Black wrote: > Hello -- > > This emerged from some tinkering, and I actually thought it was kind > of cool: > [snip] Looks like an interesting idea. One problem I see, though, is that if I do this: class Foo private def foo; end protectedly do def bar; end end def xyz; end end then xyz is public. I tried solving this problem by overriding public/private/protected, and in the privately block saving the current access level and restoring it when the block exits. I also have to save "self" so that I end up with an access level of public when I close one class and open another. The problem I have is this: class Foo privately do; ... end end class Foo publicly do; ... end def foo; end end Here, Foo#foo ends up private, which is not the desired behavior. Is there any way to detect when a class has been "closed"? (I also have run into a similar problem implementing 'secret' methods in Ruby, and a clean solution would certainly be nice) (A 'secret' method is a special type of private method that can only be called from the class in which it was defined, and which warns the user when an attempt is made to define a method with the same name in the derived class. It's not an elegant solution, but it does work). Paul