core-event 0.1.0 → 0.2.0
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/CHANGELOG.md +7 -0
- data/lib/core/event/callable.rb +18 -4
- data/lib/core/event/version.rb +1 -1
- data/lib/is/eventable.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: 739c47b481fdec959e56fea3cc8c9237c57f234d2e4c62623dffa73acb82b2da
|
4
|
+
data.tar.gz: 1ba1b84dae588284b71b208bf5cf6cb08786b97948f315f3096fdce70353d1e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 562048680c429a521b545e3dff895d449c32f249ccb9e73b4e72ec884d19463f4204b50a17e159a49111b3bfbeb0e9af3c7d38a10edb8aa62c5c311bcc166aba
|
7
|
+
data.tar.gz: 9961c12afde7c84f45e81ff7c081c9cdd81b4b2a9b1fc4a7b27f352111885bc2bf64a1e3346b439562d0745f5abd5cf2e03dd3421471c586cc06ffa41e4ce996
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## [v0.2.0](https://github.com/metabahn/corerb/releases/tag/2021-11-03)
|
2
|
+
|
3
|
+
*released on 2021-11-03*
|
4
|
+
|
5
|
+
* `fix` [#101](https://github.com/metabahn/corerb/pull/101) Prevent unnecessary recompiles of the event pipeline ([bryanp](https://github.com/bryanp))
|
6
|
+
* `add` [#100](https://github.com/metabahn/corerb/pull/100) Add a finalizer to the event pipeline ([bryanp](https://github.com/bryanp))
|
7
|
+
|
1
8
|
## [v0.1.0](https://github.com/metabahn/corerb/releases/tag/2021-10-24)
|
2
9
|
|
3
10
|
*released on 2021-10-24*
|
data/lib/core/event/callable.rb
CHANGED
@@ -19,6 +19,7 @@ module Core
|
|
19
19
|
@mutex = Mutex.new
|
20
20
|
@events = []
|
21
21
|
@pipelines = {}
|
22
|
+
@compiled = false
|
22
23
|
end
|
23
24
|
|
24
25
|
def initialize_copy(...)
|
@@ -81,25 +82,38 @@ module Core
|
|
81
82
|
# [public] Calls callbacks for the given event with the given arguments.
|
82
83
|
#
|
83
84
|
def performing(object, event, ...)
|
84
|
-
|
85
|
+
finalize.performing(object, event, ...)
|
85
86
|
end
|
86
87
|
|
87
88
|
# [public] Calls before callbacks for the given event with the given arguments.
|
88
89
|
#
|
89
90
|
def starting(object, event, ...)
|
90
|
-
|
91
|
+
finalize.starting(object, event, ...)
|
91
92
|
end
|
92
93
|
|
93
94
|
# [public] Calls after callbacks for the given event with the given arguments.
|
94
95
|
#
|
95
96
|
def finished(object, event, ...)
|
96
|
-
|
97
|
+
finalize.finished(object, event, ...)
|
98
|
+
end
|
99
|
+
|
100
|
+
# [public]
|
101
|
+
#
|
102
|
+
def finalize
|
103
|
+
compile
|
104
|
+
|
105
|
+
self
|
97
106
|
end
|
98
107
|
|
99
108
|
private def compile
|
109
|
+
return if compiled?
|
110
|
+
|
100
111
|
instance_eval(Compiler.compile(self), __FILE__, __LINE__ - 1)
|
112
|
+
@compiled = true
|
113
|
+
end
|
101
114
|
|
102
|
-
|
115
|
+
private def compiled?
|
116
|
+
@compiled == true
|
103
117
|
end
|
104
118
|
|
105
119
|
private def call_callbacks(object, type, event, ...)
|
data/lib/core/event/version.rb
CHANGED
data/lib/is/eventable.rb
CHANGED
@@ -58,5 +58,15 @@ module Is
|
|
58
58
|
events.callback(*during, before: before, after: after, method: method, context: context, &block)
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
extends :implementation, prepend: true do
|
63
|
+
# [public]
|
64
|
+
#
|
65
|
+
def finalize
|
66
|
+
super if defined?(super)
|
67
|
+
events.finalize
|
68
|
+
self
|
69
|
+
end
|
70
|
+
end
|
61
71
|
end
|
62
72
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: core-event
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.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
|
+
date: 2021-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: core-extension
|