There are a lot of supplemental information in the Internet about private
and protected
methods in Ruby, and about the difference between them. But I found no info regarding practical usage of the protected
ones. When and why could we need to use them in real world? Could one provide an example, please?
Asked
Active
Viewed 37 times
0

DreamWalker
- 1,327
- 1
- 11
- 19
-
I would rather ask when you would want a `private` method. – sawa Mar 07 '16 at 15:04
-
@sawa private methods are commonly used – DreamWalker Mar 07 '16 at 15:06
-
A private method is internal to the implementation of a class, and it can only be called by other instance methods of the class or its subclasses. – DreamWalker Mar 07 '16 at 15:14
-
Nope. That is protected method. – sawa Mar 07 '16 at 15:15
-
See *The Ruby Programming Language* O`Reilly p. 232 – DreamWalker Mar 07 '16 at 15:20
-
Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/105572/discussion-between-dreamwalker-and-sawa). – DreamWalker Mar 07 '16 at 15:23