I have an object from GraphQL. I need to process one field and then return a Hash.
To do this I initially tried using the to_h method. But when I tried to change the value in the field, I got this error:
FrozenError - can't modify frozen Hash
Then I came up with the idea of using the dup method. This method seems to "unfreeze" the original object:
object.to_h.dup
But this doesn't help for "deep" fields. For "deep" fields I had to use the local dup method.
Please tell me if there is a more correct solution to the problem?