class User
def say_secret_with_self
self.secret
end
protected
def secret
"secret"
end
end
u = User.new
p u.say_secret_with_self # => "secret"
I have heard that protected methods can be accessed only by inherited members. But the above is possible in ruby. Is it correct code?