Ruby gives you three levels of access: : Access level « Class « Ruby

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

1.When you use an access modifier, all the methods that follow are defined with that access, until you use a different access modifier.
2.A class with public, protected and private accessors
3.label methods: private or protected will have the indicated visibility until changed or until the definition ends.