Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use target_container alias to pass to providers #270

Merged
merged 3 commits into from May 12, 2024

Conversation

timriley
Copy link
Member

@timriley timriley commented May 6, 2024

In ProviderRegistrar, create a new target_container (an alias of its container attribute), and use this target_container when creating providers.

This makes it possible for users of dry-system to provide a subclass of the ProviderRegistrar where they can customise the target_container that their providers receive.

We need this so that providers in Hanami can receive their respective slice as the target, making it possible for code inside the provider to interact naturally with the Hanami slice itself, as opposed to its internal container (which itself knows nothing about the broader Hanami app).

As part of this change, make ProviderRegistrar and ProviderRegistrar#target_container both public API (with everything else about the provider registrar still remaining private).

See hanami/hanami#1382 for an example of usage from a dry-system consumer.

This makes it possible for users of dry-system to provide a subclass of the ProviderRegistrar where they can customise the target_container that their providers receive.
@timriley timriley merged commit f553c22 into main May 12, 2024
12 checks passed
@timriley timriley deleted the allow-custom-provider-targets branch May 12, 2024 13:46
@timriley timriley self-assigned this May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant