Enjoying playing with hanami 2.0 so far. Copied this question from the gitter chat, which seems quite dead.
How can I use
include Deps outside of an action? I can retrieve things by going to
Hanami.app["my.thing"] but it would be nice to get the mixin. Is this possible?
update: I just realised what the error was. I was trying to shorten module names by namespacing like this:
module MyApp::Middleware class DoSomething include Deps['something']
With this, it would fail with an uninitialized constant Deps.
If I break it up such that each module is listed separately, it suddenly works. I don’t know enough about magic ruby internals to explain what the difference is, but will leave this here just in case it helps someone else.