Protecting an array from modification

I want to protect an array from being modified after a certain point? It
would be sufficient to disallow, that the array gets new elements added
or elements removed. Protection agains re-assigning elements would be
nice, but is not a must.

Can I safely use ‘freeze’ on the array in this case, or would this also
protect the array from being garbage collected?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs