web_pipe
allows injecting plugs and middlewares at initialization time. As they are given as keyword arguments to the #initialize
method, web_pipe
is only compatible with the keyword argument strategy from dry-auto_inject. This is useful in the case you need to use other collaborator from your plugs' definitions.
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