These are chat archives for dry-rb/chat

15th
Jan 2016
Peter Leitzen
@splattael
Jan 15 2016 08:34
hey :)
Should we provide a public API for this? Like: Data.unregister_container?
or Data.remove_container?
Piotr Solnica
@solnic
Jan 15 2016 09:04
sth like Data.reset!
it would set new container and define constants in the namespace if configured
Peter Leitzen
@splattael
Jan 15 2016 09:23
yeah
Peter Leitzen
@splattael
Jan 15 2016 09:53
@solnic so, https://github.com/dryrb/dry-data/blob/master/spec/spec_helper.rb#L24-L26 would turn into a simple Data.reset!?
Piotr Solnica
@solnic
Jan 15 2016 10:10
@splattael yup
Peter Leitzen
@splattael
Jan 15 2016 11:50
I try to get it working... soonish :D
Piotr Solnica
@solnic
Jan 15 2016 11:50
thank you
Peter Leitzen
@splattael
Jan 15 2016 12:05
releasing products on Fridays suck :(
Andy Holland
@AMHOL
Jan 15 2016 13:26
Does this problem lie with dry-data or dry-container ?
Piotr Solnica
@solnic
Jan 15 2016 13:28
@AMHOL yes
there’s a couple of missing interfaces
Andy Holland
@AMHOL
Jan 15 2016 13:29
In dry-container?
Piotr Solnica
@solnic
Jan 15 2016 13:34
yes
ie I do _container.keys in dry-data :D
Andy Holland
@AMHOL
Jan 15 2016 13:56
So do you think just add a #keys method directly to the container?
Gonna update it to use concurrent-ruby soon too
Piotr Solnica
@solnic
Jan 15 2016 13:58
I actually thought about making it enumerable-like
limited to each and keys
that’s what I need
defo not a full-blown enumerable, but each and keys would be cool
Hannes Nevalainen
@kwando
Jan 15 2016 14:00
let each return a enumerable when not passed a block and you got all Enumerable goodies
but you probably thought about that already =)
Andy Holland
@AMHOL
Jan 15 2016 14:08
Yeah, I think the underlying container should still be hidden, but if we need #keys and #each I can add those, can see how they'd both be useful
Rather keep as narrow an interface as possible
Peter Leitzen
@splattael
Jan 15 2016 14:13
defo not a full-blown enumerable, but each and keys would be cool
@solnic if you provide #each you get a full-blown enumerable for free :D
Piotr Solnica
@solnic
Jan 15 2016 14:18
no you won’t?
Peter Leitzen
@splattael
Jan 15 2016 14:27
if you include Enumerable, no?
sure, you don't get keys but to_a etc.
Piotr Solnica
@solnic
Jan 15 2016 14:39
but we don’t want to include Enumerable
it’s not like you’re gonna need to partition or slice your items in container, I hope
:joy:
Peter Leitzen
@splattael
Jan 15 2016 14:40
ah ok, right :D
Piotr Solnica
@solnic
Jan 15 2016 14:41
I don’t bother that much with enumerable in many cases and just include it, but in libs we should be more careful
you know, wide interfaces, backward compatibility, and so on
Peter Leitzen
@splattael
Jan 15 2016 14:43
nod right, I'd somewhat expect an object to be an Enumerable by default if it would implement #each. I don't know why %)
Piotr Solnica
@solnic
Jan 15 2016 14:48
yeah me too, but this is a very specific case
Andy Holland
@AMHOL
Jan 15 2016 17:26
@solnic do you know the specific cases where you access _container?
dry-component uses dry-container and dry-auto_inject under the hood. These gems are very small and simple with a total 254LOC. Just saying. :joy:
Just seen that
Piotr Solnica
@solnic
Jan 15 2016 17:54
Yeah. Just sayin