Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created July 3, 2012 21:59
Show Gist options
  • Select an option

  • Save practicingruby/3043643 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/3043643 to your computer and use it in GitHub Desktop.
class A
class << self
private
def foo
puts "bar"
end
end
foo # outputs bar
end
A.foo # raises an error
@practicingruby

Copy link
Copy Markdown
Author

Yes, that's kind of the point of this example: Class private methods are the same as instance private methods. Kind of weird to see you comment on a gist that has no context whatsoever: It's impossible to see what the point of this code was without the accompanying conversation, as is the case for most gists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment