business_flow 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/business_flow/default_step_executor.rb +18 -4
- data/lib/business_flow/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92d2304397a649b2a73fa73a937fd8742034e432
|
4
|
+
data.tar.gz: 5d3c9f9a9cd0aa1cb2ea27eb49f73e67083f8e30
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7ac218850f590644168ffdbf3eacbdc46c801e80ec5d6a212c327dd7a8394183e73f8dbd2e6a3f4b14d49e01acff029332c9bb38060509c7dd11318f6cb9a10
|
7
|
+
data.tar.gz: 6ab08a2fc63d6b3ed44680732bd7b18eddc29e7315e6224b8fe64c90925a377032d4988cf9a06555064afe6a2fe2d09360dc08270675d8e9c8f9b9eea14fcc0d
|
data/Gemfile.lock
CHANGED
@@ -9,17 +9,27 @@ module BusinessFlow
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
ActiveSupport::Notifications.instrument(flow_name, flow: @flow) do
|
13
|
+
@step_queue.each do |step|
|
14
|
+
break unless process_step(step)
|
15
|
+
end
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
19
|
protected
|
19
20
|
|
20
21
|
def process_step(step)
|
22
|
+
catch(:halt_step) { execute_step(step) }
|
23
|
+
return true if @flow.errors.blank?
|
24
|
+
ActiveSupport::Notifications.publish(
|
25
|
+
event_name(step) + '.error', step: step, flow: @flow
|
26
|
+
)
|
27
|
+
false
|
28
|
+
end
|
29
|
+
|
30
|
+
def execute_step(step)
|
21
31
|
ActiveSupport::Notifications.instrument(
|
22
|
-
event_name(step), flow: @flow
|
32
|
+
event_name(step), flow: @flow, step: step
|
23
33
|
) do |payload|
|
24
34
|
payload[:step_result] = result = step.call(@flow)
|
25
35
|
result.merge_into(@flow)
|
@@ -27,6 +37,10 @@ module BusinessFlow
|
|
27
37
|
end
|
28
38
|
end
|
29
39
|
|
40
|
+
def flow_name
|
41
|
+
"business_flow.flow.#{@flow.class.to_s.underscore}"
|
42
|
+
end
|
43
|
+
|
30
44
|
def event_name(step)
|
31
45
|
"business_flow.step.#{@flow.class.to_s.underscore}. " \
|
32
46
|
"#{step.to_s.underscore}"
|