Here is a patch for the CVS version of Ruby to add secret methods. They work just like private or protected methods, but can only be called from methods defined in the same class as they are. They also emit a warning when a derived class attempts to hide a secret method in a base class (since this will likely break the base class).


secret - (click here to download a tarball)

secret.patch   download
test_secret.rb   download
test_secret2.rb   download


This page created by Paul Brannan
Last modified: Wednesday, 03-Sep-2003 17:25:40 EDT
URL: http://rubystuff.org/secret/index.shtml