These are chat archives for dry-rb/chat

21st
Nov 2018
Chris Richards
@cmrichards
Nov 21 2018 00:11
Is it worth using the step functionality? I haven't tried it yet but I fear losing some flexibility of just using normal methods and wonder if it's just adding unnecessary complexity.
Tim Riley
@timriley
Nov 21 2018 11:54
@cmrichards I only use it when I need it, by default I just build regular classes
Chris Richards
@cmrichards
Nov 21 2018 18:48
@timriley ok thanks.
Chris Richards
@cmrichards
Nov 21 2018 19:45
Dry::Struct::Value is driving me a bit mad:
(byebug) mrl_l
#<SingleValueLimit limit_name=:pass_fail operator=#<Operator value=">"> value=0.1>
(byebug) limit
#<SingleValueLimit limit_name=:pass_fail operator=#<Operator value=">"> value=0.1>
(byebug) mrl_l == limit
false
(byebug) mrl_l.attributes == limit.attributes
true
(byebug) mrl_l.attributes
{:limit_name=>:pass_fail, :operator=>#<Operator value=">">, :value=>0.1}
(byebug) limit.attributes
{:limit_name=>:pass_fail, :operator=>#<Operator value=">">, :value=>0.1}
(byebug)
So it seems like including Comparable in a Dry::Struct::Value is a bad idea
Don Morrison
@elskwid
Nov 21 2018 19:52
@cmrichards is that something you were doing? I think struct has dry-equalizer, would that not do what you want?
Chris Richards
@cmrichards
Nov 21 2018 20:09
It works now that i've removed the Comparable module.
Piotr Solnica
@solnic
Nov 21 2018 20:31
@cmrichards do you know how Comparable works?