:send method in ruby(Dynamic dispatch)

Dynamic dispatch in ruby allows us to send messages to an object.

# object.public_send(message, *arguments)
1.public_send(:+, 2) # => 3

:send method even allows to invoke private methods.

# object.send(message, *arguments)
1.send(:+, 2) # => 3
comments powered by Disqus