Skip to content

Instantly share code, notes, and snippets.

@jeremyf
Created January 5, 2010 15:34
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 jeremyf/269437 to your computer and use it in GitHub Desktop.
Save jeremyf/269437 to your computer and use it in GitHub Desktop.
class Foo
class << self
def bar; 'class bar'; end
protected :bar
end
def bar; 'instance bar'; end
end
if $0 == __FILE__
begin
puts Foo.bar
rescue NoMethodError => e
puts 'Called protected method'
end
puts Foo.new.bar
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment