public
Created

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
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 >

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.