core-pipeline 0.3.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/lib/core/pipeline/callable.rb +19 -3
- data/lib/core/pipeline/compiler.rb +1 -1
- data/lib/core/pipeline/version.rb +1 -1
- data/lib/is/pipeline/controller.rb +21 -0
- data/lib/is/pipeline.rb +7 -10
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9eee559c3f6611fda78768fb157652092a3dac590799cf2f090a9f3e1a24e14c
|
4
|
+
data.tar.gz: 13b37adb6f55e86139d25935ce2d61d9b244250d2ea708f294d1d267d3faa88e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15e60e985150582f18e66f7caa3feea227cfdb6cfe83fe77deb40897e048c42d50b161aac7ea279e5be1ee30faf831274252d7a064bdc90cd14b07d1b2fbf5fb
|
7
|
+
data.tar.gz: d06cab76f50362c0b6b013ea52801141b329d0da26768d186bcc2d44fdcd568f5b257a55651f576853900a407e9aeca33279542602b6f996a27ceb283a39b450
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
## [v0.5.1](https://github.com/metabahn/corerb/releases/tag/2021-11-23.1)
|
2
|
+
|
3
|
+
*released on 2021-11-23.1*
|
4
|
+
|
5
|
+
* `chg` [#109](https://github.com/metabahn/corerb/pull/109) Prefer `__send__` to `send` ([bryanp](https://github.com/bryanp))
|
6
|
+
|
7
|
+
## [v0.5.0](https://github.com/metabahn/corerb/releases/tag/2021-11-06)
|
8
|
+
|
9
|
+
*released on 2021-11-06*
|
10
|
+
|
11
|
+
* `add` [#105](https://github.com/metabahn/corerb/pull/105) Move pipeline control methods to their own module ([bryanp](https://github.com/bryanp))
|
12
|
+
|
13
|
+
## [v0.4.1](https://github.com/metabahn/corerb/releases/tag/2021-11-03)
|
14
|
+
|
15
|
+
*released on 2021-11-03*
|
16
|
+
|
17
|
+
* `fix` [#99](https://github.com/metabahn/corerb/pull/99) Prevent pipelines from being recompiled unnecessarily ([bryanp](https://github.com/bryanp))
|
18
|
+
|
19
|
+
## [v0.4.0](https://github.com/metabahn/corerb/releases/tag/2021-11-02.1)
|
20
|
+
|
21
|
+
*released on 2021-11-02*
|
22
|
+
|
23
|
+
* `add` [#98](https://github.com/metabahn/corerb/pull/98) Add a finalizer to pipelines ([bryanp](https://github.com/bryanp))
|
24
|
+
|
1
25
|
## [v0.3.0](https://github.com/metabahn/corerb/releases/tag/2021-11-02)
|
2
26
|
|
3
27
|
*released on 2021-11-02*
|
@@ -102,23 +102,39 @@ module Core
|
|
102
102
|
# [public] Calls the pipeline in context of an object with the given arguments.
|
103
103
|
#
|
104
104
|
def call(object, ...)
|
105
|
-
|
105
|
+
finalize.call(object, ...)
|
106
|
+
end
|
107
|
+
|
108
|
+
# [public] Finalizes the pipeline.
|
109
|
+
#
|
110
|
+
def finalize
|
111
|
+
compile
|
112
|
+
|
113
|
+
self
|
106
114
|
end
|
107
115
|
|
108
116
|
private def compile
|
117
|
+
return if compiled?
|
118
|
+
|
109
119
|
instance_eval(@compiler.compile(self, @object), __FILE__, __LINE__ - 1)
|
110
120
|
@compiled = true
|
111
|
-
self
|
112
121
|
end
|
113
122
|
|
114
123
|
private def recompile
|
115
|
-
|
124
|
+
remove_compiled_call
|
116
125
|
compile
|
117
126
|
end
|
118
127
|
|
119
128
|
private def compiled?
|
120
129
|
@compiled == true
|
121
130
|
end
|
131
|
+
|
132
|
+
private def remove_compiled_call
|
133
|
+
return unless compiled?
|
134
|
+
|
135
|
+
singleton_class.remove_method(:call)
|
136
|
+
@compiled = false
|
137
|
+
end
|
122
138
|
end
|
123
139
|
end
|
124
140
|
end
|
@@ -41,7 +41,7 @@ module Core
|
|
41
41
|
case action[:finalized]
|
42
42
|
when Symbol
|
43
43
|
if object.private_method_defined?(action[:finalized])
|
44
|
-
"object.
|
44
|
+
"object.__send__(#{action[:finalized].inspect}, ...)\n"
|
45
45
|
else
|
46
46
|
"object.#{action[:finalized]}(...)\n"
|
47
47
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Is
|
4
|
+
module Pipeline
|
5
|
+
# [public]
|
6
|
+
#
|
7
|
+
module Controller
|
8
|
+
# [public] Halts the execution of the pipeline, setting the pipeline's current value to the given object.
|
9
|
+
#
|
10
|
+
private def halt(value = nil)
|
11
|
+
raise Core::Pipeline::Signals::Halted.new(value)
|
12
|
+
end
|
13
|
+
|
14
|
+
# [public] Rejects the current action, skipping the rest of the action and calling remaining pipeline actions.
|
15
|
+
#
|
16
|
+
private def reject
|
17
|
+
raise Core::Pipeline::Signals::Rejected
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/is/pipeline.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "is/extension"
|
4
4
|
require "is/stateful"
|
5
5
|
|
6
|
+
require_relative "pipeline/controller"
|
6
7
|
require_relative "../core/pipeline/callable"
|
7
8
|
require_relative "../core/pipeline/compiler"
|
8
9
|
require_relative "../core/pipeline/signals/halted"
|
@@ -56,7 +57,7 @@ module Is
|
|
56
57
|
end
|
57
58
|
end
|
58
59
|
|
59
|
-
extends :implementation do
|
60
|
+
extends :implementation, dependencies: [Is::Pipeline::Controller] do
|
60
61
|
# [public] Calls a pipeline with arguments.
|
61
62
|
#
|
62
63
|
def call(...)
|
@@ -100,16 +101,12 @@ module Is
|
|
100
101
|
end
|
101
102
|
|
102
103
|
extends :implementation, prepend: true do
|
103
|
-
# [public]
|
104
|
+
# [public]
|
104
105
|
#
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
# [public] Rejects the current action, skipping the rest of the action and calling remaining pipeline actions.
|
110
|
-
#
|
111
|
-
private def reject
|
112
|
-
raise Core::Pipeline::Signals::Rejected
|
106
|
+
def finalize
|
107
|
+
super if defined?(super)
|
108
|
+
pipeline.finalize
|
109
|
+
self
|
113
110
|
end
|
114
111
|
end
|
115
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: core-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: core-extension
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/core/pipeline/signals/rejected.rb
|
71
71
|
- lib/core/pipeline/version.rb
|
72
72
|
- lib/is/pipeline.rb
|
73
|
+
- lib/is/pipeline/controller.rb
|
73
74
|
homepage: https://github.com/metabahn/corerb/
|
74
75
|
licenses:
|
75
76
|
- MPL-2.0
|