core-event 0.1.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/lib/core/event/callable.rb +18 -4
- data/lib/core/event/version.rb +1 -1
- data/lib/is/eventable.rb +12 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e13d20e07e469eaa28b8fda8cfdb55a81e13142959f448679d51c1477f3f44f5
|
4
|
+
data.tar.gz: 43a00e18aba884d4f9bd00468856aeaf8f0c96a92dc9b50bd60be36f2ec25c83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1899688796c6f87462b76390d9227aa2c528805b421123abe81db8c4c01ebbd824ae2b9f3006c68f366e70b39a52b950055040ccec1c591bdf20f9093ac82c09
|
7
|
+
data.tar.gz: 1ccd996291cc2cce213ad759edc0986e2b5659e65c0c5d23aff7c2883b2b466db84cd66c904a33351d256f6d748314dc6829b876659cdd013b666e3c9fdf3753
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,22 @@
|
|
1
|
+
## [v0.2.2](https://github.com/metabahn/corerb/releases/tag/2022-06-02)
|
2
|
+
|
3
|
+
*released on 2022-06-02*
|
4
|
+
|
5
|
+
* `fix` [#127](https://github.com/metabahn/corerb/pull/127) Accept all arguments in prepended finalize ([bryanp](https://github.com/bryanp))
|
6
|
+
|
7
|
+
## [v0.2.1](https://github.com/metabahn/corerb/releases/tag/2021-11-06)
|
8
|
+
|
9
|
+
*released on 2021-11-06*
|
10
|
+
|
11
|
+
* `fix` [#106](https://github.com/metabahn/corerb/pull/106) Use pipeline controller in core-event ([bryanp](https://github.com/bryanp))
|
12
|
+
|
13
|
+
## [v0.2.0](https://github.com/metabahn/corerb/releases/tag/2021-11-03)
|
14
|
+
|
15
|
+
*released on 2021-11-03*
|
16
|
+
|
17
|
+
* `fix` [#101](https://github.com/metabahn/corerb/pull/101) Prevent unnecessary recompiles of the event pipeline ([bryanp](https://github.com/bryanp))
|
18
|
+
* `add` [#100](https://github.com/metabahn/corerb/pull/100) Add a finalizer to the event pipeline ([bryanp](https://github.com/bryanp))
|
19
|
+
|
1
20
|
## [v0.1.0](https://github.com/metabahn/corerb/releases/tag/2021-10-24)
|
2
21
|
|
3
22
|
*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
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "is/extension"
|
4
|
-
require "is/pipeline"
|
4
|
+
require "is/pipeline/controller"
|
5
5
|
require "is/stateful"
|
6
6
|
|
7
7
|
require_relative "../core/event/callable"
|
@@ -32,7 +32,7 @@ module Is
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
extends :implementation, dependencies: [Is::Pipeline, Is::Stateful] do
|
35
|
+
extends :implementation, dependencies: [Is::Pipeline::Controller, Is::Stateful] do
|
36
36
|
# [public] Calls callbacks for the given event with the given arguments.
|
37
37
|
#
|
38
38
|
def performing(event, ...)
|
@@ -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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: core-extension
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0.
|
47
|
+
version: '0.5'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0.
|
54
|
+
version: '0.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: core-state
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
101
|
+
rubygems_version: 3.3.13
|
102
102
|
signing_key:
|
103
103
|
specification_version: 4
|
104
104
|
summary: Adds events to Ruby objects.
|