Sha256: 4dd9e57d378a427d8094e88e11b145565ffc3646c1f6f19515e4640cdd983e4e

Contents?: true

Size: 851 Bytes

Versions: 6

Compression:

Stored size: 851 Bytes

Contents

class Trailblazer::Activity
  module TaskWrap
    # TaskWrap step that calls the actual wrapped task and passes all `original_args` to it.
    #
    # It writes to wrap_ctx[:return_signal], wrap_ctx[:return_args]
    def self.call_task(wrap_ctx, original_args)
      task = wrap_ctx[:task]

      original_arguments, original_circuit_options = original_args

      # Call the actual task we're wrapping here.
      # puts "~~~~wrap.call: #{task}"
      return_signal, return_args = task.(original_arguments, **original_circuit_options)

      # DISCUSS: do we want original_args here to be passed on, or the "effective" return_args which are different to original_args now?
      wrap_ctx = wrap_ctx.merge(
        return_signal: return_signal,
        return_args:   return_args
      )

      return wrap_ctx, original_args
    end
  end # Wrap
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
trailblazer-activity-0.17.0 lib/trailblazer/activity/task_wrap/call_task.rb
trailblazer-activity-0.16.4 lib/trailblazer/activity/task_wrap/call_task.rb
trailblazer-activity-0.16.3 lib/trailblazer/activity/task_wrap/call_task.rb
trailblazer-activity-0.16.2 lib/trailblazer/activity/task_wrap/call_task.rb
trailblazer-activity-0.16.1 lib/trailblazer/activity/task_wrap/call_task.rb
trailblazer-activity-0.16.0 lib/trailblazer/activity/task_wrap/call_task.rb