Module: Related::DataFlow

Included in:
Related
Defined in:
lib/related/data_flow.rb

Defined Under Namespace

Classes: DataFlowJob

Instance Method Summary collapse

Instance Method Details

#clear_data_flowsObject



14
15
16
# File 'lib/related/data_flow.rb', line 14

def clear_data_flows
  @data_flows = {}
end

#data_flow(name, steps) ⇒ Object



4
5
6
7
8
# File 'lib/related/data_flow.rb', line 4

def data_flow(name, steps)
  @data_flows ||= {}
  @data_flows[name.to_sym] ||= []
  @data_flows[name.to_sym] << steps
end

#data_flowsObject



10
11
12
# File 'lib/related/data_flow.rb', line 10

def data_flows
  @data_flows
end

#execute_data_flow(name_or_flow, data) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/related/data_flow.rb', line 18

def execute_data_flow(name_or_flow, data)
  @data_flows ||= {}
  if name_or_flow.is_a?(Hash)
    enqueue_flow(name_or_flow, data)
  else
    flows = @data_flows[name_or_flow.to_sym] || []
    flows.each do |flow|
      enqueue_flow(flow, data)
    end
  end
end