protected(*args) private

With no arguments, sets the default visibility for subsequently defined methods to protected. With arguments, sets the named methods to have protected visibility. String arguments are converted to symbols.

If a method has protected visibility, it is callable only where self of the context is the same as the method. (method definition or instance_eval). This behavior is different from Java’s protected method. Usually private should be used.

Note that a protected method is slow because it can’t use inline cache.

To show a private method on RDoc, use

Show source
Register or log in to add new notes.