Typed
is a dry-types
+ dry-struct
alternative. It provides a similar API in order to ease migration.
Compared to dry-struct
, Typed
has an improved support of "nullable" and "missable" fields:
Typed::String.nullable
: accepts aString
, orNil
.Typed::String.missable
: accepts aString
, or no value at all (represented byTyped::Undefined
).Typed::String.nullable.missable
: accepts aString
,Nil
, or no value at all (represented byTyped::Undefined
). This behavior is difficult to obtain withdry-struct
.
Typed
only targets the use-case of converting controller parameters into Ruby objects with proper type checks and coercions.
gem 'bm-typed', require: 'typed'
Not yet.
This gem is a PoC and it shouldn't be considered production-ready.
Copyright (c) 2018 Bannerman, Frederic Terrazzoni
Licensed under the MIT license.