dry-rb / dry-transaction

Business transaction DSL
http://dry-rb.org/gems/dry-transaction
MIT License
468 stars 55 forks source link

Custom step adapters documentation bug #129

Open graudeejs opened 4 years ago

graudeejs commented 4 years ago

Describe the bug

In the documentation of dry-transaction section Custom step adapters there is a code snippet:

QUEUE = []

class MyStepAdapters < Dry::Transaction::StepAdapters
  register :enqueue, -> step, input, *args {
    # In a real app, this would push the operation into a background worker queue
    QUEUE << step.operation.call(input, *args)

    Dry::Monads.Success(input)
  }
end

However actual interface is different.

To Reproduce

Expected behavior

Code snippet in documentation needs to be updated to something like:

QUEUE = []

class MyStepAdapters < Dry::Transaction::StepAdapters
  register :enqueue, ->(operation, _options, args) {
    # In a real app, this would push the operation into a background worker queue
    QUEUE << operation.call(*args))

    Dry::Monads.Success(input)
  }
end

Also text describing interface (#call(step, input, *args)) needs to be updated accordingly.

Your environment

krisleech commented 1 year ago

You can submit a PR for the docs by going to the page and clicking "Edit in Github" 👍