Created
August 22, 2011 11:48
-
-
Save bryanl/1162207 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
ree-1.8.7-2011.03 :001 > class Foo | |
ree-1.8.7-2011.03 :002?> class << self | |
ree-1.8.7-2011.03 :003?> def foo | |
ree-1.8.7-2011.03 :004?> puts "foo" | |
ree-1.8.7-2011.03 :005?> end | |
ree-1.8.7-2011.03 :006?> private | |
ree-1.8.7-2011.03 :007?> def bar | |
ree-1.8.7-2011.03 :008?> puts "bar" | |
ree-1.8.7-2011.03 :009?> end | |
ree-1.8.7-2011.03 :010?> end | |
ree-1.8.7-2011.03 :011?> end | |
=> nil | |
ree-1.8.7-2011.03 :012 > Foo.foo | |
foo | |
=> nil | |
ree-1.8.7-2011.03 :013 > Foo.bar | |
NoMethodError: private method `bar' called for Foo:Class | |
from (irb):13 | |
ree-1.8.7-2011.03 :014 > Foo.send(:bar) | |
bar | |
=> nil | |
ree-1.8.7-2011.03 :015 > |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment