ar2dto icon indicating copy to clipboard operation
ar2dto copied to clipboard

Experiment using Ruby's 3.2 `Data` structures for the DTOs

Open santib opened this issue 3 years ago • 0 comments
trafficstars

These Data objects are similar to Structs but they are immutable. This property sounds interesting for the DTOs that this gem generates. There might be some challenges though, like how to keep these DTOs be ActiveModel compliant, or having methods like ==.

One option could be that if you set active_model_compliace to false then you get a Data object, otherwise you get what you get today. If this feels too strict, Data.define classes can be extended in theory, so they might be able to provide enough ActiveModel stuff to make Rails happy.

santib avatar Oct 10 '22 13:10 santib