hacks/secret

A hack to allow "secret" methods that can only be called by the class that created them, and will issue warnings when "secret" methods are overridden in derived classes.

A secret method is also private, but does not show up in the list of private methods.

TODO: This example is rather long.

E.g.:

  class Foo
  secret
    def foo
      puts "you should not see this message (foo)"
    end
    puts "You should see a warning:"
    def foo
    end
    def self.foo2
      puts "you should not see this message (foo2)"
    end
  private
    def this_is_a_private_function
    end
  secret
    def this_is_another_private_function
    end
    private :this_is_another_private_function
  end

class Bar < Foo def bar foo end def bar2 Foo::foo2 end puts "You should see a warning:" def foo end end

b = Bar.new

exception = false begin b.bar2 rescue NameError exception = true end

begin b.bar rescue NameError exception = true end

class Module < Object

class Object < Object

Requires

hacks/safe_send