core-handler 0.0.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b1cba00f61d0beed241065e9694b3493ff41e40a5e6e059ce00677a3ad1b1ba4
4
- data.tar.gz: 730d4ee6201dadb1f4457d31d3ac2ea2a1b5c365d75e3ab76f1f15e6d4648b8b
3
+ metadata.gz: d2b55e3bad418bc060e18b219481b314963d66c45bfe727536ea00a9c5b57522
4
+ data.tar.gz: 2447848742744f8ebfb76ec845223fd6d5aa9d6ea5cc1cde0603aac37c19a397
5
5
  SHA512:
6
- metadata.gz: c55b9af1df99cbae5129e8d51f36d5091e79af8f3b059a156c32d3509a7d1b9cd18453abe6510b21684422c8e14047fceda3b55f5392cc4edea886d89b2d8479
7
- data.tar.gz: 7bb25ff4166af43a520a945e7d64cc1b6208e11fe614da16ba341b03a000470f46c9e06ee6b760867a4f9e071670ba781da4f2b309d26bf443b58a086b870cf3
6
+ metadata.gz: 6f6f56b8576603be2d8dec577cbc3b2352fa734d6ee33f2a702fab59457ba0c38e7d7fe32dda9501711124c27362b41a3bae241f2028b60cd0a0b877cc389f32
7
+ data.tar.gz: a2d23b8c6a8d5bdb1540a095c364dc077b4e0fb6ea7ba2a5565cee61e8314a1a27fa9acf94758878b02476b162ed055f28cc4835cc3a02899199330aacc8f92e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [v0.1.2](https://github.com/metabahn/corerb/releases/tag/2022-04-13)
2
+
3
+ *released on 2022-04-13*
4
+
5
+ * `fix` [#123](https://github.com/metabahn/corerb/pull/123) Fix reference to version file ([bryanp](https://github.com/bryanp))
6
+
7
+ ## [v0.1.1](https://github.com/metabahn/corerb/releases/tag/2021-11-06)
8
+
9
+ *released on 2021-11-06*
10
+
11
+ * `fix` [#107](https://github.com/metabahn/corerb/pull/107) Use pipeline controller in core-handler ([bryanp](https://github.com/bryanp))
12
+
13
+ ## [v0.1.0](https://github.com/metabahn/corerb/releases/tag/2021-11-03)
14
+
15
+ *released on 2021-11-03*
16
+
17
+ * `fix` [#103](https://github.com/metabahn/corerb/pull/103) Prevent unnecessary recompiles of the handler pipeline ([bryanp](https://github.com/bryanp))
18
+ * `add` [#102](https://github.com/metabahn/corerb/pull/102) Add a finalizer to the handler pipeline ([bryanp](https://github.com/bryanp))
19
+
1
20
  ## [v0.0.0](https://github.com/metabahn/corerb/releases/tag/2021-11-02)
2
21
 
3
22
  *released on 2021-11-02*
@@ -90,17 +90,26 @@ module Core
90
90
  # [public]
91
91
  #
92
92
  def trigger(object, event, ...)
93
- compile.trigger(object, event, ...)
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
- singleton_class.remove_method(:trigger)
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)
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Core
4
4
  module Handler
5
- VERSION = "0.0.0"
5
+ VERSION = "0.1.2"
6
6
 
7
7
  def self.version
8
8
  VERSION
data/lib/core/handler.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Core
4
4
  module Handler
5
- require_relative "event/version"
5
+ require_relative "handler/version"
6
6
  end
7
7
  end
8
8
 
data/lib/is/handler.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/handler/callable"
@@ -26,7 +26,7 @@ module Is
26
26
  end
27
27
  end
28
28
 
29
- extends :implementation, dependencies: [Is::Pipeline, Is::Stateful] do
29
+ extends :implementation, dependencies: [Is::Pipeline::Controller, Is::Stateful] do
30
30
  # [public]
31
31
  #
32
32
  def handling(...)
@@ -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.0.0
4
+ version: 0.1.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: 2021-11-02 00:00:00.000000000 Z
11
+ date: 2022-04-14 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.1'
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.1'
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.2.22
101
+ rubygems_version: 3.3.7
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Adds handlers to Ruby objects.