What does `send()` do in Ruby, and how is it used?

Both explanations are spot on! However, one thing to keep in mind is that send() can also invoke private methods, which isn’t always desirable:

class Secret
  private
  
  def hidden_message
    "This is private!"
  end
end

s = Secret.new
puts s.send(:hidden_message)  # Works, but bypasses privacy!

If you want to ensure only public methods are called, use public_send() instead:

s.public_send(:hidden_message) # Will raise an error since it's private

This makes the code safer and prevents accidentally calling internal methods.