Can I use dry-auto_inject in a gem and provide sane defaults

I’m writing a simple little search tree implementation. I provide bare-bones implementations of, say, how to deal with logical-AND, but I’d like knowledgable users to be able to override it.

SO…is there a way to set up default values for DI? I want the gem to be useful out-of-the-box, but also configurable if that’s your thing.

Ideally, a call to MyClass.new would work without any setup by the end-user at all.

My guess is either this is easy and I just can’t see it, or this isn’t a good way to do it and I don’t understand why.

I think the best approach here would be to make your class compatible with dry-auto_inject, but not actually use it.

So this means that your dependencies should be passed through the initializer, which is where you can also provide your defaults.

Then, if a user came along and wanted to use your classes with dry-auto_inject, they could just include the mixin and it’d override defaults with the objects that it resolves from the container.