Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubysend and public_sendSingle-choice MCQ

What is the key behavioral difference between `send` and `public_send` demonstrated here?

class Account def initialize(n) = @n = n private def secret = @n end a = Account.new(42) puts a.send(:secret) # works puts a.public_send(:secret) # raises NoMethodError