crack_pipe 0.2.2 → 0.2.3
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 +11 -7
- data/lib/crack_pipe/action.rb +4 -6
- 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: 2f69aa51b284be0cc4591174c988f58739859c43
|
4
|
+
data.tar.gz: a010016caa3ca329aa077c66482977ce15671ed5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 365bdf787f4e67acfcfdec26c5496c221dc86f7900b266fb0b0985790917ff0800505850125e23a4634203c9e660399b452ef4b2e012af2ec90c8fa0da4c2c11
|
7
|
+
data.tar.gz: 8870e300e25b7b9b8aaebb21a2663cb15190c524fd7edc365ef09a7f7ac8e7bf599fde9f1b8d4c122f00bdde58b154a31d58879297be806be57439ee1aa2b953
|
@@ -11,7 +11,7 @@ module CrackPipe
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def action(action, context, track = :default)
|
14
|
-
action.steps.each_with_object([]) do |s, results|
|
14
|
+
action.class.steps.each_with_object([]) do |s, results|
|
15
15
|
next unless track == s.track
|
16
16
|
results!(results, action, s, context).last.tap do |r|
|
17
17
|
action.after_flow_control(r)
|
@@ -51,14 +51,13 @@ module CrackPipe
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def step(action, step, context)
|
54
|
+
kwargs = kwargs_with_context(action, context)
|
55
|
+
|
54
56
|
output = catch(:signal) do
|
55
|
-
|
56
|
-
|
57
|
-
action.public_send(e, context, **context)
|
58
|
-
when Proc
|
59
|
-
action.instance_exec(context, **context, &e)
|
57
|
+
if (e = step.exec).is_a?(Symbol)
|
58
|
+
action.public_send(e, context, **kwargs)
|
60
59
|
else
|
61
|
-
e.call(context, **
|
60
|
+
e.call(context, **kwargs)
|
62
61
|
end
|
63
62
|
end
|
64
63
|
|
@@ -71,6 +70,11 @@ module CrackPipe
|
|
71
70
|
|
72
71
|
private
|
73
72
|
|
73
|
+
def kwargs_with_context(action, context)
|
74
|
+
return context if action.kwargs_overrides.empty?
|
75
|
+
context.merge(action.kwargs_overrides)
|
76
|
+
end
|
77
|
+
|
74
78
|
def results!(results, action, step, context)
|
75
79
|
o = step(action, step, context)
|
76
80
|
return results.concat(o.history) if o.is_a?(Result)
|
data/lib/crack_pipe/action.rb
CHANGED
@@ -44,16 +44,14 @@ module CrackPipe
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
attr_reader :
|
47
|
+
attr_reader :kwargs_overrides
|
48
48
|
|
49
|
-
def initialize(
|
50
|
-
@__default_context__ = default_context.dup
|
49
|
+
def initialize(**kwargs_overrides, &blk)
|
51
50
|
@__wrapper__ = block_given? ? blk : nil
|
52
|
-
@
|
51
|
+
@kwargs_overrides = kwargs_overrides
|
53
52
|
end
|
54
53
|
|
55
54
|
def call(context, **)
|
56
|
-
context = @__default_context__.merge(context)
|
57
55
|
return @__wrapper__.call(Exec.(self, context)) if @__wrapper__
|
58
56
|
Exec.(self, context)
|
59
57
|
end
|
@@ -75,7 +73,7 @@ module CrackPipe
|
|
75
73
|
output
|
76
74
|
end
|
77
75
|
|
78
|
-
def fail!(output)
|
76
|
+
def fail!(output = nil)
|
79
77
|
Exec.halt(output, false)
|
80
78
|
end
|
81
79
|
|
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.3
|
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-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|