I’m trying to create a struct that has an attribute of an array that is either empty or each member is a specific type.
class MyStruct < Dry::Struct
attribute :my_attribute Types::Arrray.of(Integer) | Types::Array.empty? # this doesn't work but I hope it communicates what I'm trying todo
end
I’d like the array to be there and if it has anything in it, it must be a certain type, otherwise, it should be empty.