-
-
Save kikito/1153947 to your computer and use it in GitHub Desktop.
Don't use self.methodname if methodname is private
This file contains 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 A | |
def foo | |
baz | |
end | |
def bar | |
self.baz | |
end | |
private | |
def baz | |
"baz" | |
end | |
end | |
a = A.new | |
a.foo #works ok | |
a.bar #throws "Attempt to call private method" error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment