These are chat archives for dry-rb/chat

10th
Apr 2016
Tim Cooper
@coop
Apr 10 2016 07:35
Luca Guidi
@jodosha
Apr 10 2016 08:13
@solnic Thanks for pinging, I'll be available later this week. Off for a company retreat. See you!
Tim Cooper
@coop
Apr 10 2016 11:27

@solnic

required(:name).filled(size?: 1..60)

I’m guessing that filled? an implicit string?

Piotr Solnica
@solnic
Apr 10 2016 11:30
@coop filled means not-empty, not-empty string, not empty array, not empty hash, nil is treated as an empty value of course, everything else is treated as filled
Tim Cooper
@coop
Apr 10 2016 11:32
I’m interested what size?: 1..60 is being applied to if you’re not specifying a type.
Piotr Solnica
@solnic
Apr 10 2016 11:33
oh, dooh, yeah this is missing a type expectation
Tim Cooper
@coop
Apr 10 2016 11:33
Ha great.
Piotr Solnica
@solnic
Apr 10 2016 11:33
I mean…in Form it’s not needed, it’s always a string, but you can be paranoid there too
Tim Cooper
@coop
Apr 10 2016 11:33
Yeah.
Piotr Solnica
@solnic
Apr 10 2016 11:33
it really depends on the level of paranoia you need :laughing:
Tim Cooper
@coop
Apr 10 2016 11:34
By default filled will be whatever is in the value right? If it was a string then it would limit it to 1 to 60 characters but if it was an array it would be 1 to 60 elements right?
filled? would just check then it isn’t empty.
I personally like the idea of specifying types.
Piotr Solnica
@solnic
Apr 10 2016 11:40
@coop yes, it checks ‘size’ for String, Array and Hash, otherwise checks if it’s not nil
Tim Cooper
@coop
Apr 10 2016 11:40
Yep - works as I expected.