--

From:

Question: What is an object freezing in Ruby and why would you do that?

Answer: Freezing an object just means preventing it from changing .freeze will do the trick

I would add that .freeze also reduce objects allocations, thus less strings are created and less needed to be garbage collected. I read that this now comes by default on Ruby 3.

--

--

David Mauricio
David Mauricio

Written by David Mauricio

Full Stack Ruby on Rails Developer. Software Engineer @ SpiderDoor LLC