Created
January 5, 2010 15:34
-
-
Save jeremyf/269437 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
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