Created
July 18, 2013 04:27
-
-
Save madpilot/6026715 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| def this_fails | |
| puts self.bar | |
| end | |
| def this_works | |
| puts bar | |
| end | |
| private | |
| def bar | |
| "Foo#bar" | |
| end | |
| end | |
| foo = Foo.new | |
| foo.this_fails | |
| NoMethodError: private method `bar' called for #<Foo:0x007fc68314e0a0> | |
| foo.this_works | |
| => "Foo#bar" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment