class Linearly::Flow

Public Class Methods

new(*steps) click to toggle source

Constructor for the {Flow}

@param steps [Array<Step>] array of things that implement the Step

interface (+call+, +inputs+ and +outputs+ methods).

@api public @example

flow = Linearly::Flow.new(
  Users::Find,
  Users::AddRole.new(:admin),
  Users::Save,
)
# File lib/linearly/flow.rb, line 54
def initialize(*steps)
  @steps = steps
  @contract = Contract.new(steps)
end

Public Instance Methods

>>(other) click to toggle source

Convenience method to join +Step+s into one {Flow}

@param other [Step]

@return [Flow] @api public @example

flow =
  Users::Find
  .>> Users::Update
  .>> Users::Save
# File lib/linearly/flow.rb, line 70
def >>(other)
  Flow.new(other, *@steps)
end

Private Instance Methods

steps() click to toggle source

Steps to be ran by the {Flow}

@return [Array<Step>] @api private

# File lib/linearly/flow.rb, line 80
def steps
  [
    Validation::Inputs.new(self, inputs),
    *@steps.map(&Runner.method(:new)),
    Validation::Outputs.new(self, outputs),
  ]
end