Created
August 25, 2013 14:59
-
-
Save tisba/6334284 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 A | |
class << self | |
protected | |
def protected_class_method | |
puts "I'm a protected class method! Called by #{caller.first}" | |
end | |
end | |
end | |
class B < A | |
protected_class_method | |
end | |
A.protected_class_method | |
# I'm a protected class method! Called by method_accessability.rb:11:in `<class:B>' | |
# method_accessability.rb:16:in `<main>': protected method `protected_class_method' called for A:Class (NoMethodError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment