I have such construction
Types::String.default { [SecureRandom.hex(12), suffix].join.freeze }
I wanted to create such custom type, I came up with this:
HexDefault =
Dry.Types.Constructor(Types::String) do |suffix|
[SecureRandom.hex(12), suffix].join.freeze
end
and using like this
attribute :uid, Types::HexDefult[suffix]
but it generates the hex right way, it doesn’t create a callable object