Sha256: c6f9e3f51a9a584f0eded1c9d2141f2d1326a62a65a00d1a3aea39103fbab36f

Contents?: true

Size: 694 Bytes

Versions: 5

Compression:

Stored size: 694 Bytes

Contents

class Trailblazer::Circuit
  module Task
    # Convenience functions for tasks. Totally optional.

    # Task::Binary aka "step"
    # Step is binary task: true=> Right, false=>Left.
    # Step call proc.(options, flow_options)
    # Step is supposed to run Option::KW, so `step` should be Option::KW.
    #
    # Returns task to call the proc with (options, flow_options), omitting `direction`.
    # When called, the task always returns a direction signal.
    def self.Binary(step, on_true=Right, on_false=Left)
      ->(direction, *args) do # Activity/Task interface.
        [ step.(direction, *args) ? on_true : on_false, *args ] # <=> Activity/Task interface
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trailblazer-circuit-0.0.11 lib/trailblazer/circuit/task.rb
trailblazer-circuit-0.0.10 lib/trailblazer/circuit/task.rb
trailblazer-circuit-0.0.9 lib/trailblazer/circuit/task.rb
trailblazer-circuit-0.0.8 lib/trailblazer/circuit/task.rb
trailblazer-circuit-0.0.7 lib/trailblazer/circuit/task.rb