1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Correct documentation for protected methods [ci skip]

This commit is contained in:
John Hawthorn 2022-03-11 19:21:50 -08:00
parent b180ffa622
commit 962a3247b1

View file

@ -155,8 +155,8 @@ Ruby has three types of visibility. The default is +public+. A public method
may be called from any other object.
The second visibility is +protected+. When calling a protected method the
sender must be a subclass of the receiver or the receiver must be a subclass of
the sender. Otherwise a NoMethodError will be raised.
receiver must inherit the Class or Module which defines the method. Otherwise a
NoMethodError will be raised.
Protected visibility is most frequently used to define <code>==</code> and
other comparison methods where the author does not wish to expose an object's