Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.