Class: ActiveOperation::Pipeline
- Defined in:
 - lib/active_operation/pipeline.rb
 
Defined Under Namespace
Classes: OperationFactory
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Methods inherited from Base
call, #call, #completed?, from_proc, #halted?, #initialize, inputs, #perform, perform, #succeeded?, to_proc
Constructor Details
This class inherits a constructor from ActiveOperation::Base
Class Method Details
.compose(*operations, &block) ⇒ Object
      43 44 45 46 47 48 49 50 51 52 53 54 55  | 
    
      # File 'lib/active_operation/pipeline.rb', line 43 def compose(*operations, &block) raise ArgumentError, "Expects either an array of operations or a block with configuration instructions" unless !!block ^ !operations.empty? if block Class.new(self, &block) else Class.new(self) do operations.each do |operation| use operation end end end end  | 
  
.operations ⇒ Object
      25 26 27  | 
    
      # File 'lib/active_operation/pipeline.rb', line 25 def operations [] end  | 
  
.use(operation, options = {}) ⇒ Object
      29 30 31 32 33 34 35 36 37 38 39 40 41  | 
    
      # File 'lib/active_operation/pipeline.rb', line 29 def use(operation, = {}) operation = ActiveOperation::Base.from_proc(operation) if operation.kind_of?(Proc) if operations.empty? inputs = operation.inputs inputs.each do |input| input input.name, type: input.type end end (@operations ||= []) << OperationFactory.new(operation, ) end  |