29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/decouplio/composer.rb', line 29
def compose(logic_container_raw_data:, action_class:, palp_prefix: :root, parent_flow: {}, next_steps: nil)
flow = logic_container_raw_data.steps
palps = logic_container_raw_data.palps
steps_pool = {}
steps_flow = {}
flow = prepare_raw_data(flow, palp_prefix, action_class)
validate_flow(flow, palps, next_steps, action_class)
flow = compose_flow(flow, palps, next_steps, action_class, parent_flow)
flow.each do |step_id, stp|
steps_flow[step_id] = stp[:flow]
steps_flow.merge!((stp))
steps_pool[step_id] = create_step_instance(stp, flow)
steps_pool.merge!((stp))
end
{
first_step: steps_pool.keys.first,
steps_pool: steps_pool.freeze,
steps_flow: steps_flow.freeze
}
end
|