dry-transaction icon indicating copy to clipboard operation
dry-transaction copied to clipboard

Custom step adapters documentation bug

Open graudeejs opened this issue 6 years ago • 1 comments

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

  • Affects my production application: NO
  • Ruby version: 2.6.3
  • OS: Linux/5.3.8-gentoo

graudeejs avatar Nov 15 '19 11:11 graudeejs

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

krisleech avatar Jun 07 '23 16:06 krisleech