Created
August 14, 2019 11:37
-
-
Save AJFaraday/2b4537efdcacd0bacd19854b49d2985d to your computer and use it in GitHub Desktop.
Private methods WAT
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 Wat | |
def fine | |
foo | |
end | |
def not_fine | |
self.foo | |
end | |
private | |
def foo | |
'this is fine' | |
end | |
end | |
Wat.new.fine | |
# 'this is fine' | |
Wat.new.not_fine | |
# NoMethodError: private method `foo' called for #<Wat:0x0000000d932fa8> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment