These are chat archives for dry-rb/chat

23rd
May 2017
Rafael George
@cored
May 23 2017 00:37
what's the best approach to use auto_inject with a Rails app
an initializer ?
I'm using it that way; after a lot of hard coded constants in service objects definition I just realize the reason why dependency injection is a virtue and why Rails is missing a way to inject dependencies
Tim Riley
@timriley
May 23 2017 00:44
An initializer to set up your injector seems to make sence, @cored
Stergio
@stergiom
May 23 2017 05:11
auto_inject works fine with JRuby but not in its AOT compiled form, here it breaks with an ArgumentError, not sure if this is an issue or just a limitation of JRuby AOT compilation but here is the gist fwiw
Tim Riley
@timriley
May 23 2017 06:21
@stergiom hmm, interesting. Does JRuby AOT compiled code impose any limitations over normal ruby?
Stergio
@stergiom
May 23 2017 06:26
I dug into that, there wasn't much on the topic other than a few posts saying that all things ruby & ruby-metaprogramming should be possible, but since AOT compilation happens in issolation on a file by file basis I think it might not be getting the full intent of include Inject[:thing]
Tim Riley
@timriley
May 23 2017 06:32
Yeah, I guess.
But in your case it’s all in one file?
Stergio
@stergiom
May 23 2017 06:46
yup, I said that wrong, was aiming for include Inject[:thing] might not get introspected (or even be able to be introspected) during AOT compilation
I'll report it to JRuby and see what comes back..
Nikita Shilnikov
@flash-gordon
May 23 2017 07:04
@stergiom post a link here once you do it
Stergio
@stergiom
May 23 2017 07:08
jruby/jruby#4621
Nikita Shilnikov
@flash-gordon
May 23 2017 08:10
@stergiom this is a bug in jruby, I updated the issue, for now don't use *, **, it's the same as just * anyway
Stergio
@stergiom
May 23 2017 08:14
:beers: @flash-gordon, that does seem to work