These are chat archives for dry-rb/chat

Apr 2017
Dean Chuang
Apr 12 2017 00:42
Hello, I'm trying to use the AutoInject module with a framework called Hanami for a project I'm working on. Currently using it to inject objects into specific controller actions. Without getting into the bowels of the framework, is there a good way for me to selectively inject a different instance of an object into a specific controller action? Much thanks!
Oskar Szrajer
Apr 12 2017 10:42
not sure what you want to achieve. Import just overwrite initializer and define for you reader. So if you Import["foo"] you get access to method foo, thats all
if you need just something from container in one given place and you don't want to import it, you can just call YourConatainer["foo"].anything_else
Oskar Szrajer
Apr 12 2017 10:59
if you keep specific instance of object in container, you will always got this. That's the purpose behind. To not to create new instance every time you need use some method but reuse always the same
Joe Van Dyk
Apr 12 2017 16:55
what's the best way to serialize/deserialize a dry-struct to json and back?
Piotr Solnica
Apr 12 2017 20:30
@joevandyk we don’t have a solution for this, maybe look at representable (not sure if it’s gonna work with dry-struct though, but you can always dump structs to hashes and maybe this will work)