Ruby gives you three levels of access:
The visibility or access of methods and constants may be set with the methods public, private, or protected.
Public methods - Can be called from anywhere in your code.
Protected methods - Can be called only inside objects of the class that defines those methods, or objects of classes derived from that class.
Private methods - Can only be called inside the current object.
Related examples in the same category