These are chat archives for dry-rb/chat

14th
Sep 2016
Muhammad Hilmy Fauzan
@muhifauzan
Sep 14 2016 09:00
Guys, how can I make high level rule in nested schema that check value from parent schema?
Rafael George
@cored
Sep 14 2016 12:29
is there a way in virtus for me to call all my attributes value objects to_s when I do .to_h
I wrote something like def to_h; super.merge(field: value_object.to_s)
but looks kinda hacky don't know if there's a declarative way of doing such thing
Daniel Gollahon
@dgollahon
Sep 14 2016 17:02

Hi. Is there a way to create anonymous rules in dry-validations? Or do i have to specify them as:

rule(name: %i[args])

I'm not saying this should be a feature, just curious if it exists. I have a case where I'm validating something but do not at all care about the error messages, only whether or not the thing is valid. I also use mutant in CI and it complains that it can rename the argument name__mutant__. I can expose the schema and expect something about it to kill the mutant, but if there already happens to be a way to define the rule anonymously, that'd be cool.

Daniel Gollahon
@dgollahon
Sep 14 2016 23:14
Also, just a bit of positive feedback on dry-v. I had a validation I had to do that involved a bit of awkward boolean logic that was dramatically simplified by having > available. Made working on a validation task I had today fun instead of frustrating :D
Don Morrison
@elskwid
Sep 14 2016 23:22
@cored I’d make a new method that does that and you can access the attribute_set and attributes on the instance.
Piotr Solnica
@solnic
Sep 14 2016 23:26
@dgollahon this is an interesting use-case that I haven’t thought about, could you please report an issue about this?
Daniel Gollahon
@dgollahon
Sep 14 2016 23:26
@solnic the anonymous rule?
Piotr Solnica
@solnic
Sep 14 2016 23:26
@dgollahon re your positive feedback, thank you, it made my day <3 :)
@dgollahon yes :)
Daniel Gollahon
@dgollahon
Sep 14 2016 23:26
sure, i'll open an issue in a couple of minutes. :)
@solnic: great. :) I've been working with dry-validation all morning and it's been my favorite coding task of the week so far.
Piotr Solnica
@solnic
Sep 14 2016 23:27
w00t :) I’ll be releasing 0.10.0 tomorrow/Friday
Daniel Gollahon
@dgollahon
Sep 14 2016 23:27
awesome :)