Ruby 2.7 has added FrozenError#receiver
to return the frozen object on which modification was attempted. It is similar to NameError#receiver
. This can help in pinpointing the frozen object.
freeze
on objects, to make sure objects are not allowed to be mutated by others. If we try to modify such a frozen object, it will throw a FrozenError
.