so my question is: how can you assign a variable calling the method as the name of the method? It seems that I missed something.
Not. In this code
def name=(name) @name = name end
name= not variable name calls method = . method name= .
Edit:
In the above snippet of code def paired with the ending end is a method definition.
def method_name(param1, param2)
On the same line as def , there can only be a method name, optional parentheses and a list of parameters. By definition, having a "variable calling a method" on this line would be illegal. So in your code name= is the name of the method.
jcm
source share