Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Andy Holland
@AMHOL
lol, yep, will be at work
Piotr Solnica
@solnic
that work thing you do man, gotta stop
;)
Andy Holland
@AMHOL
haha
That would be nice
Piotr Solnica
@solnic
just stop, be a free man, work 12hrs/day, like me, LOL
Andy Holland
@AMHOL
I keep playing Lotto
Piotr Solnica
@solnic
it’s called Lotto in UK too? :D
Andy Holland
@AMHOL
haha yeah, a FREE man?
Yeah
Lotto and Lotto Euro Millions
Piotr Solnica
@solnic
sweet, didn’t know that
Andy Holland
@AMHOL
I need a win on the Euro
Piotr Solnica
@solnic
I thought Lotto is a polish brand
Andy Holland
@AMHOL
Nope, is it run by Camelot there?
Piotr Solnica
@solnic
no idea, I think it’s a national lottery
Andy Holland
@AMHOL
Yeah, Camelot -> National Lottery = Lotto (AFAIK)
Piotr Solnica
@solnic
OK :)
hey I gotta run
I’ll describe my rodakase vision and put it in a readme soon
Andy Holland
@AMHOL
OK :wave:
Piotr Solnica
@solnic
we could start at least chatting about it :)
cheers
:wave:
Andy Holland
@AMHOL
Yeah, just give me a shout when you do
Piotr Solnica
@solnic
will do
Andy Holland
@AMHOL
@solnic you around?
Piotr Solnica
@solnic
Kinda
Andy Holland
@AMHOL
lol, just messing about with the validator stuff
Piotr Solnica
@solnic
Oh cool. Where?
Andy Holland
@AMHOL
Not pushed it anywhere yet, just making a gist
The gist vs the comment
I'm leaning towards the gist myself, that would allow the processor to be switched out for nested validations or anything else someone wants to do
Then I can put the extractor/validation container config on the processor
WDYT?
Piotr Solnica
@solnic
I'll check it out tomorrow. Too late for me already :)
Andy Holland
@AMHOL
:+1: cheers
Andy Holland
@AMHOL
Getting somewhere with this now
Andy Holland
@AMHOL
v = Dry::Validator.new(
  name: {
    presence: true
  },
  test: {
    embedded: {
      tester: {
        presence: true
      }
    }
  }
)

v.call(name: '', test: { tester: '' })
# => {:name=>[{:code=>"presence", :options=>true}], :test=>[{:tester=>[{:code=>"presence", :options=>true}]}]}
v.call(name: 'Joe', test: { tester: 't' })
# => {}
v = Dry::Validator.new(
  users: {
    each: {
      name: {
        presence: true
      }
    }
  }
)

v.call(users: [{ name: 'Joe' }, { name: '' }])
# => {:users=>[{}, {:name=>[{:code=>"presence", :options=>true}]}]}
v.call(users: [{ name: 'Joe' }])
# => {}
Piotr Solnica
@solnic
looking good
Andy Holland
@AMHOL
:)
Piotr Solnica
@solnic
btw I really like Dry name
because Dry has been misunderstood by many rubyists and not everybody realized what it really means
Andy Holland
@AMHOL
Yeah, I've seen a few cases of that too lol
Piotr Solnica
@solnic
FWIW DRY in Rails mostly means “I’m gonna use reflection and make millions of assumptions so that you will just inherit from this magic class and more magic will appear"
:sparkles:
Andy Holland
@AMHOL
haha yeah
AR DRY