These are chat archives for dry-rb/chat

22nd
Jul 2016
Fran Worley
@fran-worley
Jul 22 2016 09:42
@solnic are you around to chat about reform / dry-v integration? The way we do it now involves compiling 2 schemas for every validation block which a - crazy and b - makes it impossible to define & reuse configs
Piotr Solnica
@solnic
Jul 22 2016 10:02
@fran-worley can you report a reform issue and describe it there? I’ll chime in
Fran Worley
@fran-worley
Jul 22 2016 10:02
Will do
Piotr Solnica
@solnic
Jul 22 2016 10:17
I’m trying to stay away from gitter until rom 2.0 is released
Kevin Ross
@rosskevin
Jul 22 2016 17:46

here is my email predicate:

        def email?(value)
          !/[-a-z0-9_+\.]+\@([-a-z0-9]+\.)+[a-z0-9]{2,4}/i.match(value).nil?
        end

Used like required(:email).filled(:str?, :email?)
Can I just prepend str? && in the custom predicate and drop it from the usage?

Kevin Ross
@rosskevin
Jul 22 2016 18:49
Any easy dry-validation magic for something like one_of i.e. one_of: [:a, :b]?
Fran Worley
@fran-worley
Jul 22 2016 18:53
@rosskevin take a look at the dry validation site
There is a section on built in predicates. You want included_in
Kevin Ross
@rosskevin
Jul 22 2016 18:54
ah, thanks for the pointer required(:sample).value(inclusion?: [1,3,5])
other point of confusion, when to use filled(..) vs value(..), for example this case^^^
Piotr Solnica
@solnic
Jul 22 2016 20:04
@rosskevin filled prepends filled? & … predicate
so filled(:email?) == value(:filled?, :email?)
Kevin Ross
@rosskevin
Jul 22 2016 20:05
so in the above, woulded we want required(:sample).filled(inclusion?: [1,3,5])
or is that redundant
Piotr Solnica
@solnic
Jul 22 2016 20:06
probably redundant
Kevin Ross
@rosskevin
Jul 22 2016 20:06
gotit, because an empty check is unnecessary at that point
Piotr Solnica
@solnic
Jul 22 2016 20:06
don’t you want included_in?: [1, 3, 5] though?
oh wait, you don’t :)
Kevin Ross
@rosskevin
Jul 22 2016 20:07
I was going to say it doesn't appear on the built-in predicates page
Piotr Solnica
@solnic
Jul 22 2016 20:07
no wait, you do, we renamed inclusion to included_in
Kevin Ross
@rosskevin
Jul 22 2016 20:07
ok
Piotr Solnica
@solnic
Jul 22 2016 20:08
damn, gotta update the website docs
Kevin Ross
@rosskevin
Jul 22 2016 20:08
I like the newer name
Fran Worley
@fran-worley
Jul 22 2016 22:37
@solnic that's my bad, I was meant to sort that and forgot...
Piotr Solnica
@solnic
Jul 22 2016 22:48
@fran-worley no worries
Fran Worley
@fran-worley
Jul 22 2016 22:50

franfail

Looks like the hash tag hadn't made it to gitter...
Nikita Shilnikov
@flash-gordon
Jul 22 2016 23:13
@fran-worley gitter's parser isn't smart, eg it doesn't allow to use oblique text twice in one message. At least you can edit your message if needed
Piotr Solnica
@solnic
Jul 22 2016 23:43
I used to constantly do dis:

winning

:D