With the introduction of Ruby 3.2, Data.define is now the preferred way to handle DTOs (Data Transfer Objects) in modern Ruby applications.

While Struct has been the go-to for years, it has several quirks that make it less-than-ideal for pure data transfer. Data was specifically designed to be a "Value Object" factory.

Here is a deep dive into...