These are chat archives for dry-rb/chat

30th
May 2017
Cyril Sadovnik
@sadovnik
May 30 2017 11:00

Hi guys!

I'm trying to make a structure using dry-struct. I need to restrict an attribute to have only instances of a specific class.

I found that there is Types::Class type in dry-types. How do I specify an exact class?

Cyril Sadovnik
@sadovnik
May 30 2017 15:35
@flash-gordon and @v-kolesnikov suggest these options:
Dry::Types::Definition.new(Foo).constrained(type: Foo)
Dry::Types.module::Any.constrained(type: Foo)