Typed structs and value objects for Ruby
open sourceMITfree
dry-struct defines typed struct classes in Ruby with a Virtus-like DSL, built on dry-types: each attribute has a type that coerces and checks its value (for example an optional String, or a coercible Integer that turns "21" into 21), and structs are meant to be immutable. It's part of the dry-rb collection of Ruby libraries.
Problems it solves
- define typed value objects in Ruby
- coerce and validate attributes of a Ruby struct
- a Virtus-like typed attribute DSL for Ruby
Features
- typed struct classes with an attribute DSL
- type coercion and constraints via dry-types
- immutable structs