I am not used to Complex class in Ruby. I read the doc but I cannot figure how to modify the real or imaginary part of such a complex number. The accessor to modify these fields is not provided.
c=Complex(1,2)
c.real= 4 # impossible as is
So my question is : how to modify the real or imaginary part of a complex number in Ruby ?
I particulary think a solution based on open class should be possible ?
You will have to create a new complex number: