Similar to How to remove a default from `dry-types` custom class attribute?
But with any constraints.
Life example:
We have attribute? :max_quantity, Types::Integer.constrained(gteq: 1, lteq: 10)
.
In console it looks like #<Dry::Types[Constrained<Nominal<Integer> rule=[type?(Integer) AND gteq?(1) AND lteq?(10)]>]>
.
I’d like to get #<Dry::Types[Constrained<Nominal<Integer> rule=[type?(Integer)]>]>
.
.type
, as for default, doesn’t help: it returns #<Dry::Types[Nominal<Integer>]>
.
So, I’d like to have something like .constraints
, which returns Hash
, which I can modify or re-use as options for a new type.
Or, I saw internal .with
method, probably we need for something like .without
.
What do you think?