Skip to content

Instantly share code, notes, and snippets.

@AJFaraday
Created August 14, 2019 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AJFaraday/2b4537efdcacd0bacd19854b49d2985d to your computer and use it in GitHub Desktop.
Save AJFaraday/2b4537efdcacd0bacd19854b49d2985d to your computer and use it in GitHub Desktop.
Private methods WAT
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