evt-entity_projection 1.0.0.0 → 2.0.1.3

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: 92296fb41fdb9b4461a3b8e5f7edfa8006e064ab14655a71f1c599633b4e85c7
4
- data.tar.gz: 75a42938521f69c87d0efa8d9307bdca1f2c77b1ff3f6f41783335fa21561018
3
+ metadata.gz: 761f98e03675a3c025eda4ed63e548792dac082dc78d12ba2811847bc795b4d5
4
+ data.tar.gz: df5b411589381ff1b43c3e012a3c178d4f9fecbb0f4051e1f1351d4124e09e9d
5
5
  SHA512:
6
- metadata.gz: 32abe281e55c594ebc8d45cb53ea4a88c7c2295531f672405a997ba6768cba5c6efc6889c829ef48c6d31a951b1c6b1ca74f77490f003d3a803cd795428afdc0
7
- data.tar.gz: d72c53024fa75160fb48a32daa24758f1fc551068db18b4de41e3a79b00b9d303e95efba01263e85f97c698607958eda115b75fbc9e4dfdbf0e3c62ca949c488
6
+ metadata.gz: 18311918ead97c2843e57e9e070ae5d343699e0e88285413cff65d37f5c41fd008c3b62d6ce7872ec5d6cb02693d45ad7ee628dfac88d0c2fc6779abecfc01d3
7
+ data.tar.gz: 76c779048768e5112460ae5a7c2fb767550c118c5ea725bceca2880e53e5f4c5e4cfc3ff5ae6c18396d67377c98364c86427b04000cf1a3999698169d904deea
@@ -13,11 +13,23 @@ module EntityProjection
13
13
  end
14
14
 
15
15
  module ApplyMethod
16
- class Example
17
- include EntityProjection
16
+ module EventData
17
+ class Example
18
+ include EntityProjection
18
19
 
19
- def apply(event_data)
20
- entity.some_attribute = event_data.data[:attribute]
20
+ def apply(event_data)
21
+ entity.some_attribute = event_data.data[:attribute]
22
+ end
23
+ end
24
+ end
25
+
26
+ module Message
27
+ class Example
28
+ include EntityProjection
29
+
30
+ def apply(message)
31
+ entity.some_attribute = message.some_attribute
32
+ end
21
33
  end
22
34
  end
23
35
  end
@@ -37,6 +49,15 @@ module EntityProjection
37
49
  end
38
50
  end
39
51
 
52
+ module RegisterMessageClass
53
+ class Example
54
+ include EntityProjection
55
+ include Controls::Message
56
+
57
+ register SomeMessage
58
+ end
59
+ end
60
+
40
61
  module Anomaly
41
62
  module NoApply
42
63
  class Example
@@ -10,6 +10,7 @@ module EntityProjection
10
10
  extend Info
11
11
  extend ApplyMacro
12
12
  extend EventRegistry
13
+ extend Register
13
14
  extend EntityNameMacro
14
15
 
15
16
  virtual :configure
@@ -48,7 +49,7 @@ module EntityProjection
48
49
  def handler_name(event_or_event_data)
49
50
  name = nil
50
51
 
51
- if event_or_event_data.is_a?(MessageStore::MessageData::Read)
52
+ if event_or_event_data.is_a?(MessageStore::MessageData)
52
53
  name = Messaging::Message::Info.canonize_name(event_or_event_data.type)
53
54
  else
54
55
  name = event_or_event_data.message_name
@@ -107,6 +108,12 @@ module EntityProjection
107
108
  end
108
109
  end
109
110
 
111
+ module Register
112
+ def register(event_class)
113
+ event_registry.register(event_class)
114
+ end
115
+ end
116
+
110
117
  module EntityNameMacro
111
118
  def entity_name_macro(entity_name)
112
119
  send(:define_method, entity_name) do
@@ -132,6 +139,10 @@ module EntityProjection
132
139
 
133
140
  unless handler.nil?
134
141
  public_send(handler, event)
142
+ else
143
+ if respond_to?(:apply)
144
+ apply(event)
145
+ end
135
146
  end
136
147
 
137
148
  logger.info(tag: :apply) { "Applied event (Event class: #{event.class.name})" }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-entity_projection
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.0
4
+ version: 2.0.1.3
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: 2018-11-04 00:00:00.000000000 Z
11
+ date: 2020-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-messaging
@@ -85,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
85
  - !ruby/object:Gem::Version
86
86
  version: '0'
87
87
  requirements: []
88
- rubyforge_project:
89
- rubygems_version: 2.7.6
88
+ rubygems_version: 3.1.2
90
89
  signing_key:
91
90
  specification_version: 4
92
91
  summary: Projects event data into an entity