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

Load providers when accessing via ProviderRegistrar#[] #273

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

timriley
Copy link
Member

Move the logic from ProviderRegistrar#find_and_load_provider straght into #[] for a more convenient and reliable experience when interacting with providers.

Having #[] either return a provider or nil without attempting to load the provider was a potential source of confusion. Now it can work as the one and only interface for fetching a provider.

Remove the #provider alias for #[] since this was private and unused (and unnecessary).

Remove #start_provider_dependency (which was the only thing in ProviderRegistrar dealing with components instead of providers and instead invoke its internal logic (a one-liner, anyway!) directly in Container#load_component.

Move the logic from `ProviderRegistrar#find_and_load_provider` straght into `#[]` for a more convenient and reliable experience when interacting with providers.

Having `#[]` either return a provider or nil without attempting to _load_ the provider was a potential source of confusion. Now it can work as the one and only interface for fetching a provider.

Remove the `#provider` alias for `#[]` since this was private and unused (and unnecessary).

Remove `#start_provider_dependency` (which was the only thing in `ProviderRegistrar` dealing with components instead of providers and instead invoke its internal logic (a one-liner, anyway!) directly in `Container#load_component`.
@timriley timriley self-assigned this Jun 13, 2024
@timriley timriley merged commit f826656 into main Jun 13, 2024
17 checks passed
@timriley timriley deleted the load-providers-when-accessing branch June 13, 2024 11:38
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.

1 participant