core-handler 0.1.3 → 0.2.0

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: b209aa55e3bcdd3610dd60e624e3210136b586bf53a464b5d48a5257f9f64ad3
4
- data.tar.gz: c17f6a3f3eb3fcaed7aa16c3da8f63ed4a28ca5d70fd70e44959410b439ddcd4
3
+ metadata.gz: 100243a9375ec00fcf6c6ca69c21ebfb8f78a63b462adc594d8cc65eee5e631a
4
+ data.tar.gz: 8c91fef23a0ed45a7dc093102ddb885704510497bc4f7e078bb4af78196224d2
5
5
  SHA512:
6
- metadata.gz: 1d12fbdbfd8f0ee54fabc68783c6fb1419f321a84825c436735ef3670129fc8284f1e8fdebb6c8be7b4e9d2abe5c02ab207d81a1378ab6e58ce41b8f8003a46e
7
- data.tar.gz: 0d151ccec5408588d165b416a5001a0b1f1ba88f67727c4d1d8938351d9949ea2fb53ec27ce4aec0b78c15256b37959833d7d27b003aac07a3a2880d36795ae2
6
+ metadata.gz: 5ccab5c2a1649ddd7f82c3d44589af126227186356d8a5ddab711f35eb479a43a85569cfec37df1a181e23aa78db07defd3dde0e2bf08133ff890eca3c73a038
7
+ data.tar.gz: 073de397ca955c405eaf0827e72cbe64ca26fd9edce68cec6203c3039d22e1eccb11575af76ae351b08e283046ca6e30d67cf57108a852864c3800ccc0d41422
data/CHANGELOG.md CHANGED
@@ -1,33 +1,40 @@
1
- ## [v0.1.3](https://github.com/metabahn/corerb/releases/tag/2022-06-02)
1
+ ## [v0.2.0](https://github.com/bryanp/corerb/releases/tag/2023-12-24)
2
+
3
+ *released on 2023-12-24*
4
+
5
+ * `dep` [#143](https://github.com/bryanp/corerb/pull/143) Deprecate `Is::*` and `Refine::*` namespaces ([bryanp](https://github.com/bryanp))
6
+ * `dep` [#135](https://github.com/bryanp/corerb/pull/135) Remove Ruby 2 support ([bryanp](https://github.com/bryanp))
7
+
8
+ ## [v0.1.3](https://github.com/bryanp/corerb/releases/tag/2022-06-02)
2
9
 
3
10
  *released on 2022-06-02*
4
11
 
5
- * `fix` [#128](https://github.com/metabahn/corerb/pull/128) Accept all arguments in prepended finalize ([bryanp](https://github.com/bryanp))
12
+ * `fix` [#128](https://github.com/bryanp/corerb/pull/128) Accept all arguments in prepended finalize ([bryanp](https://github.com/bryanp))
6
13
 
7
- ## [v0.1.2](https://github.com/metabahn/corerb/releases/tag/2022-04-13)
14
+ ## [v0.1.2](https://github.com/bryanp/corerb/releases/tag/2022-04-13)
8
15
 
9
16
  *released on 2022-04-13*
10
17
 
11
- * `fix` [#123](https://github.com/metabahn/corerb/pull/123) Fix reference to version file ([bryanp](https://github.com/bryanp))
18
+ * `fix` [#123](https://github.com/bryanp/corerb/pull/123) Fix reference to version file ([bryanp](https://github.com/bryanp))
12
19
 
13
- ## [v0.1.1](https://github.com/metabahn/corerb/releases/tag/2021-11-06)
20
+ ## [v0.1.1](https://github.com/bryanp/corerb/releases/tag/2021-11-06)
14
21
 
15
22
  *released on 2021-11-06*
16
23
 
17
- * `fix` [#107](https://github.com/metabahn/corerb/pull/107) Use pipeline controller in core-handler ([bryanp](https://github.com/bryanp))
24
+ * `fix` [#107](https://github.com/bryanp/corerb/pull/107) Use pipeline controller in core-handler ([bryanp](https://github.com/bryanp))
18
25
 
19
- ## [v0.1.0](https://github.com/metabahn/corerb/releases/tag/2021-11-03)
26
+ ## [v0.1.0](https://github.com/bryanp/corerb/releases/tag/2021-11-03)
20
27
 
21
28
  *released on 2021-11-03*
22
29
 
23
- * `fix` [#103](https://github.com/metabahn/corerb/pull/103) Prevent unnecessary recompiles of the handler pipeline ([bryanp](https://github.com/bryanp))
24
- * `add` [#102](https://github.com/metabahn/corerb/pull/102) Add a finalizer to the handler pipeline ([bryanp](https://github.com/bryanp))
30
+ * `fix` [#103](https://github.com/bryanp/corerb/pull/103) Prevent unnecessary recompiles of the handler pipeline ([bryanp](https://github.com/bryanp))
31
+ * `add` [#102](https://github.com/bryanp/corerb/pull/102) Add a finalizer to the handler pipeline ([bryanp](https://github.com/bryanp))
25
32
 
26
- ## [v0.0.0](https://github.com/metabahn/corerb/releases/tag/2021-11-02)
33
+ ## [v0.0.0](https://github.com/bryanp/corerb/releases/tag/2021-11-02)
27
34
 
28
35
  *released on 2021-11-02*
29
36
 
30
- * `chg` [#97](https://github.com/metabahn/corerb/pull/97) Designate internal state with leading and trailing double underscores ([bryanp](https://github.com/bryanp))
31
- * `add` [#76](https://github.com/metabahn/corerb/pull/76) Initial implementation of the core-handler gem ([bryanp](https://github.com/bryanp))
37
+ * `chg` [#97](https://github.com/bryanp/corerb/pull/97) Designate internal state with leading and trailing double underscores ([bryanp](https://github.com/bryanp))
38
+ * `add` [#76](https://github.com/bryanp/corerb/pull/76) Initial implementation of the core-handler gem ([bryanp](https://github.com/bryanp))
32
39
 
33
40
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require "core/pipeline/callable"
4
4
 
5
- require "is/inspectable"
5
+ require "core/inspect"
6
6
 
7
7
  require_relative "compiler"
8
8
 
@@ -27,10 +27,10 @@ module Core
27
27
  end
28
28
  end
29
29
 
30
- include Is::Inspectable
30
+ include Core::Inspect
31
31
  inspects without: [:@object, :@mutex, :@pipelines]
32
32
 
33
- include Is::Stateful
33
+ include Core::State
34
34
  state :__used_random_suffixes__, default: []
35
35
 
36
36
  attr_reader :pipelines
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Core
4
4
  module Handler
5
- VERSION = "0.1.3"
5
+ VERSION = "0.2.0"
6
6
 
7
7
  def self.version
8
8
  VERSION
data/lib/core/handler.rb CHANGED
@@ -1,9 +1,63 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "core/extension"
4
+ require "core/pipeline/behavior/controller"
5
+ require "core/state"
6
+
3
7
  module Core
8
+ # [public]
9
+ #
4
10
  module Handler
11
+ require_relative "handler/callable"
5
12
  require_relative "handler/version"
13
+
14
+ extend Core::Extension
15
+
16
+ applies do |extended:|
17
+ # [public] The current handler pipeline.
18
+ #
19
+ state :handlers, default: Callable.new(extended ? singleton_class : self)
20
+ end
21
+
22
+ extends :definition do
23
+ # [public]
24
+ #
25
+ def handle(*events, global: false, method: nil, context: nil, &block)
26
+ handlers.handle(*events, global: global, method: method, context: context, &block)
27
+ end
28
+ end
29
+
30
+ extends :implementation, dependencies: [Core::Pipeline::Behavior::Controller, Core::State] do
31
+ # [public]
32
+ #
33
+ def handling(...)
34
+ yield
35
+ rescue => error
36
+ trigger(error, ...)
37
+ end
38
+
39
+ # [public]
40
+ #
41
+ def trigger(event, ...)
42
+ @handlers.trigger(self, event, ...)
43
+ end
44
+
45
+ # [public]
46
+ #
47
+ def handle(*events, global: false, method: nil, context: nil, &block)
48
+ handlers.relocate(singleton_class)
49
+ handlers.handle(*events, global: global, method: method, context: context, &block)
50
+ end
51
+ end
52
+
53
+ extends :implementation, prepend: true do
54
+ # [public]
55
+ #
56
+ def finalize(...)
57
+ super if defined?(super)
58
+ handlers.finalize
59
+ self
60
+ end
61
+ end
6
62
  end
7
63
  end
8
-
9
- require_relative "../is/handler"
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.1.3
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: 2022-06-03 00:00:00.000000000 Z
11
+ date: 2023-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: core-extension
@@ -16,58 +16,58 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.3'
19
+ version: '0.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.3'
26
+ version: '0.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: core-inspect
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.0'
33
+ version: '0.2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.0'
40
+ version: '0.2'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: core-pipeline
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0.5'
47
+ version: '0.6'
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.5'
54
+ version: '0.6'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: core-state
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.1'
61
+ version: '0.2'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.1'
68
+ version: '0.2'
69
69
  description: Adds handlers to Ruby objects.
70
- email: bryan@metabahn.com
70
+ email: bryan@bryanp.org
71
71
  executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
@@ -78,8 +78,7 @@ files:
78
78
  - lib/core/handler/callable.rb
79
79
  - lib/core/handler/compiler.rb
80
80
  - lib/core/handler/version.rb
81
- - lib/is/handler.rb
82
- homepage: https://github.com/metabahn/corerb/
81
+ homepage: https://github.com/bryanp/corerb/
83
82
  licenses:
84
83
  - MPL-2.0
85
84
  metadata: {}
@@ -91,14 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
91
90
  requirements:
92
91
  - - ">="
93
92
  - !ruby/object:Gem::Version
94
- version: '2.7'
93
+ version: '3.0'
95
94
  required_rubygems_version: !ruby/object:Gem::Requirement
96
95
  requirements:
97
96
  - - ">="
98
97
  - !ruby/object:Gem::Version
99
98
  version: '0'
100
99
  requirements: []
101
- rubygems_version: 3.3.13
100
+ rubygems_version: 3.5.1
102
101
  signing_key:
103
102
  specification_version: 4
104
103
  summary: Adds handlers to Ruby objects.
data/lib/is/handler.rb DELETED
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "is/extension"
4
- require "is/pipeline/controller"
5
- require "is/stateful"
6
-
7
- require_relative "../core/handler/callable"
8
-
9
- module Is
10
- # [public]
11
- #
12
- module Handler
13
- extend Is::Extension
14
-
15
- applies do |extended:|
16
- # [public] The current handler pipeline.
17
- #
18
- state :handlers, default: Core::Handler::Callable.new(extended ? singleton_class : self)
19
- end
20
-
21
- extends :definition do
22
- # [public]
23
- #
24
- def handle(*events, global: false, method: nil, context: nil, &block)
25
- handlers.handle(*events, global: global, method: method, context: context, &block)
26
- end
27
- end
28
-
29
- extends :implementation, dependencies: [Is::Pipeline::Controller, Is::Stateful] do
30
- # [public]
31
- #
32
- def handling(...)
33
- yield
34
- rescue => error
35
- trigger(error, ...)
36
- end
37
-
38
- # [public]
39
- #
40
- def trigger(event, ...)
41
- @handlers.trigger(self, event, ...)
42
- end
43
-
44
- # [public]
45
- #
46
- def handle(*events, global: false, method: nil, context: nil, &block)
47
- handlers.relocate(singleton_class)
48
- handlers.handle(*events, global: global, method: method, context: context, &block)
49
- end
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
61
- end
62
- end