Created
September 30, 2010 17:56
-
-
Save cwsaylor/605013 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AccessPrivate | |
def a | |
end | |
private :a # a is now a private method | |
def accessing_private | |
a # sure! | |
self.a # nope! private methods cannot be called with an explicit receiver at all, even if that receiver is "self" | |
other_object.a # nope, a is private, you can't get it (but if it was protected, you could!) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment