These are chat archives for dry-rb/chat

27th
Aug 2016
Piotr Solnica
@solnic
Aug 27 2016 09:02
Welp. So much to do. So little time :/ I'll be improving hints after I'm done with rule ast improvements. I'd like to wrap up dry-v 0.10 before Sept 12. Fingers crossed ;P
Adam Davies
@adz
Aug 27 2016 09:10
Just read that thread... Ok I see. I'll have to try it out,but seems like these hints definitely should not be part of errors... I can't play with this for a while, but Ill try it out and submit some docs, might be useful from a new users perspective
Piotr Solnica
@solnic
Aug 27 2016 09:36
@adz they are not, but they are included by default. If you do schema.(input).message_set.dump you will get failures exclusively
Adam Davies
@adz
Aug 27 2016 09:51
Ok I'm conflating messages with errors. Sorry... However i didn't know about hints so assumed the same...
Thinking to help out new users, because I really like the approach :)
Piotr Solnica
@solnic
Aug 27 2016 10:34
It is a new concept yeah
Sergey Kukunin
@Kukunin
Aug 27 2016 16:45
because of dry-container, I can't use anonymous structs in dry-types
It says: Dry::Container::Error: Nothing registered with the key "#"
class MyStruct < Dry::Types::Struct
  attribute :my_attr, Types::Strict::String
end
Dry::Types[MyStruct]
# => MyStruct
Dry::Types[Class.new(MyStruct)]
# Dry::Container::Error: Nothing registered with the key "#"
Nikita Shilnikov
@flash-gordon
Aug 27 2016 16:55
@Kukunin and what's the reason behind using anonymous class?
I don't think it's container's issue, dry-t requires a class to have a name
Sergey Kukunin
@Kukunin
Aug 27 2016 17:03
I have a simple struct for file representation. It consists from :filename and :stream attributes, and I want to constraint :filename with different extensions in different other structs
like attribute :pdf_file, MyFile.filename_format(/\.pdf$/)
where filename_format returns anonymous subclass of MyFile struct
Sergey Kukunin
@Kukunin
Aug 27 2016 17:17
@flash-gordon it's a little bit strange, because whole dry-types is based on anonymous objects. There is no Types::Strict::String but Dry::Types::Constrained with some rules inside
Nikita Shilnikov
@flash-gordon
Aug 27 2016 17:22
well, yes, only dry-struct requires a struct to have a name
this was intentional so you don't have to register structs as types yourself
but it obviously needs some improvement
not sure what we should do with that tho, better ask @solnic or @backus
Sergey Kukunin
@Kukunin
Aug 27 2016 17:23
I guess, #<Class:0x007fd0bc379648> works fine as class name, because it's unique
ok. for now, I'll try to wrap my struct with Dry::Types::Constrained with custom predicate
Juanma Cervera
@jmcervera
Aug 27 2016 18:25
Hi everyboy,
I pretend to use dry-system along with ROM for a new project.
This would be a standalone project not a web one.
I'm trying to set up that project following the example of dry-rb/dry-system/examples/standalone but I'm struggling setting the ROM container.
Can somebody point me to an example of similar project that I can use to learn how to do it.
Thanks
Piotr Solnica
@solnic
Aug 27 2016 18:36
@jmcervera hey, check out icelab/berg on github. It is a full blown web app but it has a single system/boot/rom.rb file that you can use as a reference
The only trick is lib/berg/repository.rb with the overidden constructor to workaround one issue, although I am not even sure if we still need it O_o /cc @timriley
Juanma Cervera
@jmcervera
Aug 27 2016 18:37
@solnic Thank you. I'll fo it
I'll do it
Piotr Solnica
@solnic
Aug 27 2016 18:38
@Kukunin no need to use container for structs. Just use global struct classes
Nikita Shilnikov
@flash-gordon
Aug 27 2016 18:48
@solnic structs are being registered automatically here https://github.com/dry-rb/dry-struct/blob/master/lib/dry/struct/class_interface.rb#L30
Piotr Solnica
@solnic
Aug 27 2016 18:49
Yes they are, not sure if we still need it though??
Nikita Shilnikov
@flash-gordon
Aug 27 2016 18:49
no idea :)
at least we could check if a struct has a custom/constant name
Piotr Solnica
@solnic
Aug 27 2016 18:54
I gotta revisit this. I did it in the very early days (dry-data days) so it is very likely we don't really need this anymore
Sergey Kukunin
@Kukunin
Aug 27 2016 19:35
@solnic hey. do you want me to create issue for dry-struct gem about container use?
Piotr Solnica
@solnic
Aug 27 2016 20:07
@Kukunin yes pls. In general whenever you see that something is problematic or just confusing pls report either an issue or post your question on discuss.dry-rb.org
We're trying to shift use support to issues/discuss rather than doing it here
Somebody posted this today. Some comments are a bit sad though
Nikita Shilnikov
@flash-gordon
Aug 27 2016 20:30
@solnic TOO MANY RELEASES
just stop doing that
Piotr Solnica
@solnic
Aug 27 2016 20:50
E_TOO_MANY_RELEASES
Don Morrison
@elskwid
Aug 27 2016 20:51
:heart:
Piotr Solnica
@solnic
Aug 27 2016 20:51
FWIW the comment felt trollish but I replied anyway :)
John Backus
@backus
Aug 27 2016 22:03
@solnic I dug up our old chat and I'll move forward with this https://gitter.im/dry-rb/chat?at=57686358feaf6cd222ad7e15
John Backus
@backus
Aug 27 2016 22:16
Going to have to start with a series of PRs to dry-types
Piotr Solnica
@solnic
Aug 27 2016 22:37
@backus fantastic!
John Backus
@backus
Aug 27 2016 22:43
@solnic I opened dry-rb/dry-types#133 as the first of many small PRs