How to unfreeze a string?

x="hello "
x.freeze
x.concat "boy"
RuntimeError: can't modify frozen string

Then how to unfreeze a string?

Thanks.

You can't remove the frozen state from an object. The best you can do is to
create a duplicate the object (using dup, not clone) and modify it.

Stefano

ยทยทยท

On Monday 23 November 2009, Ruby Newbee wrote:

>x="hello "
>x.freeze
>x.concat "boy"
>RuntimeError: can't modify frozen string
>
>Then how to unfreeze a string?
>
>Thanks.
>