Create a gist now

Instantly share code, notes, and snippets.

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