Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Created September 17, 2010 06:06
Show Gist options
  • Save myronmarston/583801 to your computer and use it in GitHub Desktop.
Save myronmarston/583801 to your computer and use it in GitHub Desktop.
$ ruby private_class_method.rb
7
private_class_method.rb:13: private method `bar' called for Foo:Class (NoMethodError)
class Foo
class << self
private
def bar
7
end
end
puts bar # prints 7
end
Foo.bar # raises NoMethodError: private method `bar' called for Foo:Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment