Are there ways to separate the registration container into multiple features as modules when exploring the dry-rb gems, particularly the auto-injector, as a newcomer to Ruby?
Here is a code sample I tried but did not work.
module SomeFeatureContainter
extend Dry::Container::Mixin
register "some_service" do
SomeService.new
end
end
class Container
extend Dry::Container::Mixin
include SomeFeatureContainter
end
IocResolve = Dry::AutoInject(Container)
In order to achieve the inversion of control, you can define a container and set the injector before invoke the service though your instantiated object.