Skip to content

Instantly share code, notes, and snippets.

@bryanl
Created August 22, 2011 11:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanl/1162207 to your computer and use it in GitHub Desktop.
Save bryanl/1162207 to your computer and use it in GitHub Desktop.
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