Created
September 17, 2010 06:06
-
-
Save myronmarston/583801 to your computer and use it in GitHub Desktop.
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
$ ruby private_class_method.rb | |
7 | |
private_class_method.rb:13: private method `bar' called for Foo:Class (NoMethodError) |
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 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