evt-messaging 2.6.0.0 → 2.7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/messaging/controls/handler.rb +0 -57
- data/lib/messaging/handle.rb +23 -12
- 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: d22a40f19386098d8d266f77e69a6c794324d30f018e96a4993eab0c5cfc20e1
|
4
|
+
data.tar.gz: 8d523d0b69b432eed9e06e8e24731a77f14809fd86df46aed900feb90b2d4e9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea96206a951ad33ef9b7e7d52db38e9f9584adaa66d898cf77579608e16ebff7b597017d770bf143048809b964d3dd5d90da4bef7ab262516506ab0cfc53881c
|
7
|
+
data.tar.gz: 8655511a3ae29570de973f79b5cfd535be9f701fdd6c2a7625fb4e9f746315bcb377b35c560c18563e482af2f53096b2215dcca79956361c48e868f65d6e98c0
|
@@ -60,63 +60,6 @@ module Messaging
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
64
|
-
module SessionArgument
|
65
|
-
class Example
|
66
|
-
include Messaging::Handle
|
67
|
-
|
68
|
-
attr_accessor :session
|
69
|
-
|
70
|
-
def configure(session: nil)
|
71
|
-
self.session = session
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
module Anomaly
|
76
|
-
module Required
|
77
|
-
class Example
|
78
|
-
include Messaging::Handle
|
79
|
-
|
80
|
-
def configure(session:)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
module Positional
|
86
|
-
class Example
|
87
|
-
include Messaging::Handle
|
88
|
-
|
89
|
-
def configure(session)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
module Optional
|
94
|
-
class Example
|
95
|
-
include Messaging::Handle
|
96
|
-
|
97
|
-
def configure(session=nil)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
module Settings
|
106
|
-
Error = Class.new(RuntimeError)
|
107
|
-
|
108
|
-
class Example
|
109
|
-
include Messaging::Handle
|
110
|
-
|
111
|
-
setting :some_setting
|
112
|
-
|
113
|
-
attr_accessor :some_other_setting
|
114
|
-
|
115
|
-
def handle(message_data)
|
116
|
-
raise Settings::Error if some_setting.nil?
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
63
|
end
|
121
64
|
end
|
122
65
|
end
|
data/lib/messaging/handle.rb
CHANGED
@@ -6,7 +6,6 @@ module Messaging
|
|
6
6
|
cls.class_exec do
|
7
7
|
include Dependency
|
8
8
|
include Virtual
|
9
|
-
include Settings::Setting
|
10
9
|
|
11
10
|
def handler_logger
|
12
11
|
@handler_logger ||= Log.get(self)
|
@@ -26,37 +25,49 @@ module Messaging
|
|
26
25
|
end
|
27
26
|
|
28
27
|
module Build
|
28
|
+
Error = Class.new(RuntimeError)
|
29
|
+
|
29
30
|
def build(strict: nil, session: nil, settings: nil)
|
30
31
|
instance = new
|
31
32
|
instance.strict = strict
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
arguments = {}
|
35
|
+
|
36
|
+
if Build.send_session?(session, instance)
|
37
|
+
arguments[:session] = session
|
35
38
|
end
|
36
39
|
|
37
|
-
if Build.
|
38
|
-
|
39
|
-
else
|
40
|
-
instance.configure
|
40
|
+
if Build.send_settings?(settings, instance)
|
41
|
+
arguments[:settings] = settings
|
41
42
|
end
|
42
43
|
|
44
|
+
instance.configure(**arguments)
|
45
|
+
|
43
46
|
instance
|
44
47
|
end
|
45
48
|
|
46
|
-
def self.
|
49
|
+
def self.send_session?(session, instance)
|
50
|
+
configure?(instance, :session) && !session.nil?
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.send_settings?(settings, instance)
|
54
|
+
configure?(instance, :settings) && !settings.nil?
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.configure?(instance, parameter_name)
|
47
58
|
configure_method = instance.method(:configure)
|
48
59
|
|
49
60
|
parameter_type, _ = configure_method.parameters.find do |type, name|
|
50
|
-
name ==
|
61
|
+
name == parameter_name
|
51
62
|
end
|
52
63
|
|
53
64
|
return false if parameter_type.nil?
|
54
65
|
|
55
|
-
return true if
|
66
|
+
return true if [:key, :keyreq].include?(parameter_type)
|
56
67
|
|
57
|
-
error_message = "
|
68
|
+
error_message = "Incorrect definition of handler's configure method. The #{parameter_name} parameter must be a keyword argument (Handler: #{instance.class}, Parameter Type: #{parameter_type.inspect})"
|
58
69
|
handler_logger.error(tag: :handle) { error_message }
|
59
|
-
raise
|
70
|
+
raise Error, error_message
|
60
71
|
end
|
61
72
|
|
62
73
|
def self.handler_logger
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Eventide Project
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-message_store
|