x="hello "
x.freeze
x.concat “boy”
RuntimeError: can’t modify frozen string
Then how to unfreeze a string?
Thanks.
x="hello "
x.freeze
x.concat “boy”
RuntimeError: can’t modify frozen string
Then how to unfreeze a string?
Thanks.
On Monday 23 November 2009, Ruby N. wrote:
|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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs