I have a class that has a method:
def value=(valueIN) some code end
and this does exactly what I want when I do this:
(class instance).value="new data"
It seems like it would be cleaner if I could just override = for this class, so I don't need to do value= . First, I tried:
def =(valueIN) some code end
but this gave me an error, so I tried:
def self=(valueIN) some code end
This does not cause an error, but it does not work when I do:
(class instance)="new data"
Is an assignment something that doesn't change at the class level? If this cannot be done, it is not very important, but I was hoping that I was missing something.
source share