Data.define in Ruby 3.2: An Introduction to Immutability
Ruby 3.2 introduces a new Data
class to define immutable value objects that contain a simple set of values. Similar to the Struct
class in Ruby, it provides a simpler and more restricted API. In this article, we’ll explore what the Data
class is and how it can be useful from a practical perspective.