These are chat archives for dry-rb/chat

28th
Jun 2017
Rafael George
@cored
Jun 28 2017 14:01
do I need to always define a module Types to use Dry::Struct
why can't I just do something like attribute :name, Dry::Types::String
Nikita Shilnikov
@flash-gordon
Jun 28 2017 14:19
@cored not really, you can go with Dry::Types['string']
Rafael George
@cored
Jun 28 2017 14:20
thanks
I was wondring because it's feels redudant to me to be always writing
a module Types for each struct
I mean I can have a top level Types module and deifne everything in there however the types namespace doesn't say a lot about my domain as far as I can see
I will try to use that approach
Nikita Shilnikov
@flash-gordon
Jun 28 2017 14:28
it doesn't have to be named that way, it's only a convetion we use by default, it also doesn't have to be a single module in the app, could be one module for this and the other one for that
Rafael George
@cored
Jun 28 2017 14:29
yes
the one module for this was what I didn't like
it also can lead to confusion, I'm using dry gems in a Rails code base since the app is already built with Rails and I normally follow this convention for service objects like app/services/<namespace>/<service_object> I could set the types at the lelvel of the first namespace
however it could be weird for a new person to know where that is; maybe not
will have to think about it better