Class: Tap::Workflow

Inherits:
Task show all
Defined in:
lib/tap/workflow.rb

Instance Attribute Summary collapse

Attributes inherited from Task

#joins

Attributes inherited from App::Api

#app

Instance Method Summary collapse

Methods inherited from Task

#associations, #enq, #exe, #log, #on_complete, parser, #process

Methods inherited from App::Api

#associations, build, help, inherited, #inspect, parse, parse!, parser, #to_spec

Methods included from Signals

#sig, #signal, #signal?, #signals

Methods included from Signals::ModuleMethods

included

Constructor Details

#initialize(config = {}, app = Tap::App.current) ⇒ Workflow

Returns a new instance of Workflow.



98
99
100
101
# File 'lib/tap/workflow.rb', line 98

def initialize(config={}, app=Tap::App.current)
  super
  @entry_point, @exit_point = process
end

Instance Attribute Details

#entry_pointObject (readonly)

Returns the value of attribute entry_point.



95
96
97
# File 'lib/tap/workflow.rb', line 95

def entry_point
  @entry_point
end

#exit_pointObject (readonly)

Returns the value of attribute exit_point.



96
97
98
# File 'lib/tap/workflow.rb', line 96

def exit_point
  @exit_point
end

Instance Method Details

#call(input) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/tap/workflow.rb', line 103

def call(input)
  output = nil
  
  if exit_point
    joins = exit_point.joins
  
    collector = lambda do |result|
      output = result
      joins.delete(collector)
    end
  
    joins << collector 
  end
  
  if entry_point
    app.exe(entry_point, input)
  end
  
  output
end