The following code uses:
send("#{duck1}=", true) and I tried the following code instead and was wondering why it didn't work:
duck1.send(=,true) Terminal shows: syntax error, unexpected '=', expecting ')'
Before we even get into the valid argument types for the send method, take a look at the error message. It's telling you that it's a syntax error to have a "bare" equals sign immediately after that opening parenthesis. So, right off the bat, you know that something is very wrong.
Now, if you take a closer look at the call that does work, you'll see that you're passing the string "something=", not a "bare" equals sign. That has a chance of working, based on the types of arguments that send takes.
If you read the documentation for send, you'll see that the first argument can be either a string or a symbol. "#{duck1}=" will be interpolated to be a string, so that's valid.
Now, the question becomes, "what is duck1, and will "#{duck1}=" be interpolated to the name of an existing function? I can't answer that, it completely depends on the value of duck1.
The first argument of send must be a symbol or a string representing a method name. = is not a symbol or a string. It is not even an object. Furthermore, even if you do send(:"=", ...) or send("=", ...), it will not work unless you have defined = as a method in a non-usual way. (Edited following Bob Gilmore and Jörg W Mittag's comments)
send can also be a string.=" – define_method(:'=') do puts 'Hello' end; send(:'=') # Hello