crack_pipe 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/crack_pipe/action/exec.rb +14 -13
- data/lib/crack_pipe/action.rb +4 -4
- data/lib/crack_pipe/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33e156e850dd1455ecf3bb6f49d52b2441531dae
|
4
|
+
data.tar.gz: 9c20ce57c7b9bdca028fe10facdbe000429d243b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bdd788b6e58171c7ef9ca8c667f9931749bf6e08453f7a9a5c13406003df0ebc0bd0a3d11ca173d41acd5d49092050f46b3b91dda6c29720148e4573a9efff5
|
7
|
+
data.tar.gz: 10466088e351eb02413af98ac0fc6baf83846e8ee94801f66234cbbe9e8a6d3c857527d963e21a5e493a29ba68889052c0563a6cce0c02c920138f5807bfc3ed
|
@@ -7,23 +7,16 @@ module CrackPipe
|
|
7
7
|
module Exec
|
8
8
|
class << self
|
9
9
|
def call(action, context, track = :default)
|
10
|
-
Result.new(action(action, context,
|
10
|
+
Result.new(action(action, context, track))
|
11
11
|
end
|
12
12
|
|
13
|
-
def action(action, context,
|
14
|
-
action.steps.each_with_object(
|
13
|
+
def action(action, context, track = :default)
|
14
|
+
action.steps.each_with_object([]) do |s, results|
|
15
15
|
next unless track == s.track
|
16
|
-
|
17
|
-
if s.exec.is_a?(Action)
|
18
|
-
self.action(s.exec, context, rslts)
|
19
|
-
else
|
20
|
-
rslts << step(action, s, context)
|
21
|
-
end
|
22
|
-
|
23
|
-
rslts.last.tap do |r|
|
16
|
+
results!(results, action, s, context).last.tap do |r|
|
24
17
|
context = r[:context]
|
25
18
|
track = r[:next]
|
26
|
-
return
|
19
|
+
return results if r[:signal] == :halt
|
27
20
|
end
|
28
21
|
end
|
29
22
|
end
|
@@ -68,12 +61,20 @@ module CrackPipe
|
|
68
61
|
end
|
69
62
|
end
|
70
63
|
|
71
|
-
action.after_step(
|
64
|
+
action.after_step(output)
|
72
65
|
end
|
73
66
|
|
74
67
|
def success_with_step?(action, step, output)
|
75
68
|
step.always_pass? || step.track != :fail && !action.failure?(output)
|
76
69
|
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def results!(results, action, step, context)
|
74
|
+
o = step(action, step, context)
|
75
|
+
return results.concat(o.history) if o.is_a?(Result)
|
76
|
+
results << flow_control_hash(action, step, context, o)
|
77
|
+
end
|
77
78
|
end
|
78
79
|
end
|
79
80
|
end
|
data/lib/crack_pipe/action.rb
CHANGED
@@ -52,7 +52,7 @@ module CrackPipe
|
|
52
52
|
@steps = steps ? steps.dup : self.class.steps
|
53
53
|
end
|
54
54
|
|
55
|
-
def call(context)
|
55
|
+
def call(context, **)
|
56
56
|
context = @__default_context__.merge(context)
|
57
57
|
return @__wrapper__.call(Exec.(self, context)) if @__wrapper__
|
58
58
|
Exec.(self, context)
|
@@ -63,8 +63,8 @@ module CrackPipe
|
|
63
63
|
# for output or adding values to the context. A common example would be
|
64
64
|
# returning some kind of default failure object in place of a literal `nil`
|
65
65
|
# or `false`.
|
66
|
-
def after_step(
|
67
|
-
|
66
|
+
def after_step(output)
|
67
|
+
output
|
68
68
|
end
|
69
69
|
|
70
70
|
def fail!(output)
|
@@ -72,7 +72,7 @@ module CrackPipe
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def failure?(output)
|
75
|
-
!output
|
75
|
+
output.is_a?(Result) ? output.failure? : !output
|
76
76
|
end
|
77
77
|
|
78
78
|
def pass!(output)
|
data/lib/crack_pipe/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: crack_pipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-07-
|
12
|
+
date: 2019-07-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|