core-handler 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/core/handler/callable.rb +19 -3
- data/lib/core/handler/version.rb +1 -1
- data/lib/is/handler.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc5c64f58d1b31f8b3b69a144566c92be0cf0764623c15e2d4c6d45b6782e3e9
|
4
|
+
data.tar.gz: 8a578e1e1580a1df55b081dcb779ea2979faeb358cc13407aa9ac7719a50b297
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 264b6eec53fca6de813e7c4b054b6ba00f4aab364cc4ebae66df2a1cb47a189027f27f5276f706ec5e699d17ce509786cdb1e578e82f6a88b26530c7f5e1ac5e
|
7
|
+
data.tar.gz: ee3dce009b9909eac54e2bed224856b44eb613f7d3385e3e6f5c60ca0728804678c2b909d937031c2252c5e37ae4c8e45d9f48f6f7356a175d4e8d18c47f6dd7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [v0.1.0](https://github.com/metabahn/corerb/releases/tag/2021-11-03)
|
2
|
+
|
3
|
+
*released on 2021-11-03*
|
4
|
+
|
5
|
+
* `fix` [#103](https://github.com/metabahn/corerb/pull/103) Prevent unnecessary recompiles of the handler pipeline ([bryanp](https://github.com/bryanp))
|
6
|
+
* `add` [#102](https://github.com/metabahn/corerb/pull/102) Add a finalizer to the handler pipeline ([bryanp](https://github.com/bryanp))
|
7
|
+
|
1
8
|
## [v0.0.0](https://github.com/metabahn/corerb/releases/tag/2021-11-02)
|
2
9
|
|
3
10
|
*released on 2021-11-02*
|
@@ -90,17 +90,26 @@ module Core
|
|
90
90
|
# [public]
|
91
91
|
#
|
92
92
|
def trigger(object, event, ...)
|
93
|
-
|
93
|
+
finalize.trigger(object, event, ...)
|
94
|
+
end
|
95
|
+
|
96
|
+
# [public]
|
97
|
+
#
|
98
|
+
def finalize
|
99
|
+
compile
|
100
|
+
|
101
|
+
self
|
94
102
|
end
|
95
103
|
|
96
104
|
private def compile
|
105
|
+
return if compiled?
|
106
|
+
|
97
107
|
instance_eval(Compiler.compile(self), __FILE__, __LINE__ - 1)
|
98
108
|
@compiled = true
|
99
|
-
self
|
100
109
|
end
|
101
110
|
|
102
111
|
private def recompile
|
103
|
-
|
112
|
+
remove_compiled_trigger
|
104
113
|
compile
|
105
114
|
end
|
106
115
|
|
@@ -108,6 +117,13 @@ module Core
|
|
108
117
|
@compiled == true
|
109
118
|
end
|
110
119
|
|
120
|
+
private def remove_compiled_trigger
|
121
|
+
return unless compiled?
|
122
|
+
|
123
|
+
singleton_class.remove_method(:trigger)
|
124
|
+
@compiled = false
|
125
|
+
end
|
126
|
+
|
111
127
|
private def call_handler(object, event, handled, *args, **kwargs, &block)
|
112
128
|
if (pipeline = @pipelines[event])
|
113
129
|
pipeline.call(object, *args, event: handled, **kwargs, &block)
|
data/lib/core/handler/version.rb
CHANGED
data/lib/is/handler.rb
CHANGED
@@ -48,5 +48,15 @@ module Is
|
|
48
48
|
handlers.handle(*events, global: global, method: method, context: context, &block)
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
extends :implementation, prepend: true do
|
53
|
+
# [public]
|
54
|
+
#
|
55
|
+
def finalize
|
56
|
+
super if defined?(super)
|
57
|
+
handlers.finalize
|
58
|
+
self
|
59
|
+
end
|
60
|
+
end
|
51
61
|
end
|
52
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: core-handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
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-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: core-extension
|