Here, I will talk about the two ways you can create Data classes and compare them:
Using the block
Using the inheritance
How to create a Data class
You can define a new Data class using the block syntax:
Response = Data.define(:body, :status)
Looking at the current Ruby docs for Ruby version 3.4 this seems to be the way to do it or at least the documentation is using this way of creating a new Data class. If I dont miss anything all examples there are using this syntax.
You can also define a…