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

Make web_pipe compatible with dry-auto_inject #55

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

waiting-for-dev
Copy link
Owner

We remove the built-in resolution of plugs from a container and instead rely on the common mechanism provided by dry-auto_inject.

As we're already allowing the injection of plugs and middlewares through keyword arguents given on #initialize, web_pipe remains compatible with the keyword arguments strategy of dry-auto_inject. We make sure that the order of inclusion of either web_pipe or dry-auto_inject is irrelevant for a correct behavior via dispatching any extra keyword arguments to super.

We remove the built-in resolution of plugs from a container and instead
rely on the common mechanism provided by dry-auto_inject.

As we're already allowing the injection of plugs and middlewares through
keyword arguents given on `#initialize`, web_pipe remains compatible
with the keyword arguments strategy of dry-auto_inject. We make sure
that the order of inclusion of either web_pipe or dry-auto_inject is
irrelevant for a correct behavior via dispatching any extra keyword
arguments to `super`.

```ruby
WebPipe.load_extensions(:params)

class CreateUserApp
  include WebPipe
  include Deps[:create_user]

  plug :html, WebPipe::Plugs::ContentType.('text/html')
  plug :create

  private

  def create(conn)
    create_user.(conn.params)
  end
end
```
@waiting-for-dev waiting-for-dev force-pushed the waiting-for-dev/dry_auto_inject branch from 79f6c53 to 6a69fa5 Compare December 11, 2023 09:55
@waiting-for-dev waiting-for-dev merged commit 21815c7 into main Dec 11, 2023
6 checks passed
@waiting-for-dev waiting-for-dev deleted the waiting-for-dev/dry_auto_inject branch December 11, 2023 09:56
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