All about "Data" Simple Immutable Value Objects in Ruby 3.2

In Ruby 3.2, a new class Data was introduced as a way to define simple immutable value objects. A value object is a type of object that represents a value in a program, such as a point in 2D space or a date. The main advantage of value objects is that they are easy to understand, simple to use, and can improve the readability and maintainability of code. The proposal to add Data class was accepted by Matz on the Ruby forum here. How does it work?Using the newly defined class Data we can create a simple immutable