evil_events 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +10 -1
  4. data/.travis.yml +4 -5
  5. data/CHANGELOG.md +73 -0
  6. data/evil_events.gemspec +6 -3
  7. data/lib/evil_events.rb +3 -0
  8. data/lib/evil_events/core/broadcasting.rb +1 -0
  9. data/lib/evil_events/core/broadcasting/emitter.rb +19 -13
  10. data/lib/evil_events/core/broadcasting/emitter/adapter_proxy.rb +46 -0
  11. data/lib/evil_events/core/config.rb +37 -40
  12. data/lib/evil_events/core/events.rb +34 -3
  13. data/lib/evil_events/core/events/abstract_event.rb +4 -6
  14. data/lib/evil_events/core/events/event_extensions/class_signature.rb +13 -0
  15. data/lib/evil_events/core/events/event_extensions/class_signature/equalizer.rb +0 -2
  16. data/lib/evil_events/core/events/event_extensions/dispatchable.rb +74 -0
  17. data/lib/evil_events/core/events/event_extensions/observable.rb +2 -0
  18. data/lib/evil_events/core/events/event_extensions/serializable.rb +22 -2
  19. data/lib/evil_events/core/events/manager.rb +1 -1
  20. data/lib/evil_events/core/events/manager_registry.rb +16 -0
  21. data/lib/evil_events/core/events/manager_registry/scoped_event_type_matcher.rb +177 -0
  22. data/lib/evil_events/core/events/notifier/sequential.rb +2 -2
  23. data/lib/evil_events/core/events/serializers.rb +13 -2
  24. data/lib/evil_events/core/events/serializers/base.rb +56 -13
  25. data/lib/evil_events/core/events/serializers/base/abstract_engine.rb +47 -0
  26. data/lib/evil_events/core/events/serializers/base/abstract_factory.rb +60 -0
  27. data/lib/evil_events/core/events/serializers/base/data_transformer.rb +57 -0
  28. data/lib/evil_events/core/events/serializers/base/event_serialization_state.rb +80 -0
  29. data/lib/evil_events/core/events/serializers/base/generic_config.rb +7 -0
  30. data/lib/evil_events/core/events/serializers/hash.rb +3 -73
  31. data/lib/evil_events/core/events/serializers/hash/config.rb +11 -0
  32. data/lib/evil_events/core/events/serializers/hash/engines.rb +10 -0
  33. data/lib/evil_events/core/events/serializers/hash/engines/native.rb +60 -0
  34. data/lib/evil_events/core/events/serializers/hash/factory.rb +65 -0
  35. data/lib/evil_events/core/events/serializers/hash/packer.rb +26 -0
  36. data/lib/evil_events/core/events/serializers/hash/unpacker.rb +24 -0
  37. data/lib/evil_events/core/events/serializers/json.rb +3 -59
  38. data/lib/evil_events/core/events/serializers/json/config.rb +11 -0
  39. data/lib/evil_events/core/events/serializers/json/engines.rb +10 -0
  40. data/lib/evil_events/core/events/serializers/json/engines/native.rb +43 -0
  41. data/lib/evil_events/core/events/serializers/json/factory.rb +65 -0
  42. data/lib/evil_events/core/events/serializers/json/packer.rb +26 -0
  43. data/lib/evil_events/core/events/serializers/json/unpacker.rb +31 -0
  44. data/lib/evil_events/core/events/serializers/message_pack.rb +7 -0
  45. data/lib/evil_events/core/events/serializers/message_pack/config.rb +17 -0
  46. data/lib/evil_events/core/events/serializers/message_pack/engines.rb +10 -0
  47. data/lib/evil_events/core/events/serializers/message_pack/engines/mpacker.rb +81 -0
  48. data/lib/evil_events/core/events/serializers/message_pack/factory.rb +65 -0
  49. data/lib/evil_events/core/events/serializers/message_pack/packer.rb +26 -0
  50. data/lib/evil_events/core/events/serializers/message_pack/unpacker.rb +24 -0
  51. data/lib/evil_events/core/events/serializers/xml.rb +7 -0
  52. data/lib/evil_events/core/events/serializers/xml/config.rb +11 -0
  53. data/lib/evil_events/core/events/serializers/xml/engines.rb +10 -0
  54. data/lib/evil_events/core/events/serializers/xml/engines/ox.rb +31 -0
  55. data/lib/evil_events/core/events/serializers/xml/factory.rb +65 -0
  56. data/lib/evil_events/core/events/serializers/xml/packer.rb +26 -0
  57. data/lib/evil_events/core/events/serializers/xml/unpacker.rb +24 -0
  58. data/lib/evil_events/core/events/subscriber/mixin.rb +26 -3
  59. data/lib/evil_events/core/system.rb +28 -2
  60. data/lib/evil_events/core/system/broadcaster.rb +11 -5
  61. data/lib/evil_events/core/system/event_builder.rb +98 -34
  62. data/lib/evil_events/core/system/event_manager.rb +12 -0
  63. data/lib/evil_events/core/system/mock.rb +30 -2
  64. data/lib/evil_events/emitter.rb +4 -2
  65. data/lib/evil_events/error.rb +21 -1
  66. data/lib/evil_events/serializer.rb +14 -0
  67. data/lib/evil_events/shared.rb +1 -3
  68. data/lib/evil_events/shared/any_config.rb +60 -0
  69. data/lib/evil_events/version.rb +2 -2
  70. metadata +85 -14
  71. data/.jrubyrc +0 -1
  72. data/lib/evil_events/core/events/event_extensions/adapter_customizable.rb +0 -49
  73. data/lib/evil_events/core/events/event_extensions/emittable.rb +0 -41
  74. data/lib/evil_events/shared/combined_context.rb +0 -124
  75. data/lib/evil_events/shared/combined_context/mixin.rb +0 -43
  76. data/lib/evil_events/shared/configurable.rb +0 -7
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers
4
+ class MessagePack
5
+ # @api private
6
+ # @since 0.4.0
7
+ class Packer < Base::DataTransformer
8
+ # @param event [EvilEvents::Core::Events::AbstractEvent]
9
+ # @raise [EvilEvents::MessagePackSerializationError]
10
+ # @return [String]
11
+ #
12
+ # @see Base::DataTransformer
13
+ #
14
+ # @api private
15
+ # @since 0.4.0
16
+ def call(event)
17
+ unless event.is_a?(EvilEvents::Core::Events::AbstractEvent)
18
+ raise EvilEvents::MessagePackSerializationError
19
+ end
20
+
21
+ serialization_state = build_serialization_state(event)
22
+ engine.dump(serialization_state)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers
4
+ class MessagePack
5
+ # @api private
6
+ # @since 0.4.0
7
+ class Unpacker < Base::DataTransformer
8
+ # @param serialized_event [String]
9
+ # @raise [EvilEvents::MessagePackDeserializationErro]
10
+ # @return [EvilEvents::Core::Events::AbstractEvent]
11
+ #
12
+ # @see Base::DataTransformer
13
+ #
14
+ # @api private
15
+ # @since 0.4.0
16
+ def call(serialized_event)
17
+ raise EvilEvents::MessagePackDeserializationError unless serialized_event.is_a?(String)
18
+ serialization_state = engine.load(serialized_event)
19
+ raise EvilEvents::MessagePackDeserializationError unless serialization_state.valid?
20
+ restore_event_instance(serialization_state)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers
4
+ # @api private
5
+ # @since 0.4.0
6
+ XML = Class.new(Base)
7
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers
4
+ class XML
5
+ # @api private
6
+ # @since 0.4.0
7
+ class Config < Base::GenericConfig
8
+ configure { setting :engine, reader: true }
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers::XML
4
+ # @since 0.4.0
5
+ # @api private
6
+ class Engines
7
+ # @since 0.4.0
8
+ extend EvilEvents::Shared::DependencyContainer::Mixin
9
+ end
10
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers::XML::Engines
4
+ # @api private
5
+ # @since 0.4.0
6
+ class Ox < EvilEvents::Core::Events::Serializers::Base::AbstractEngine
7
+ # @param serialization_state [Base::EventSerializationState]
8
+ # @return [String]
9
+ #
10
+ # @since 0.4.0
11
+ # @api private
12
+ def dump(serialization_state)
13
+ ::Ox.dump(serialization_state)
14
+ end
15
+
16
+ # @param xml [String]
17
+ # @raise [EvilEvents::SerializationEngineError]
18
+ # @return [EventSerializationState]
19
+ #
20
+ # @since 0.4.0
21
+ # @api private
22
+ def load(xml)
23
+ ::Ox.parse_obj(xml)
24
+ rescue ::Ox::Error, NoMethodError, TypeError, ArgumentError
25
+ raise EvilEvents::SerializationEngineError
26
+ end
27
+ end
28
+
29
+ # @since 0.4.0
30
+ register(:ox, Ox)
31
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers
4
+ class XML
5
+ # @api private
6
+ # @since 0.4.0
7
+ class Factory < AbstractFactory
8
+ # @return [XML::Config]
9
+ #
10
+ # @api private
11
+ # @since 0.4.0
12
+ def build_config
13
+ settings = EvilEvents::Core::Bootstrap[:config].serializers.xml
14
+
15
+ Config.new do |config|
16
+ config.engine = settings.engine
17
+ end
18
+ end
19
+
20
+ # @param config [XML::Config]
21
+ # @raise [EvilEvents::UnrecognizedSerializationEngineError]
22
+ # @return [Base::AbstractEngine]
23
+ #
24
+ # @api private
25
+ # @since 0.4.0
26
+ def build_engine(config)
27
+ Engines.resolve(config.engine).new(config)
28
+ rescue Dry::Container::Error
29
+ raise EvilEvents::UnrecognizedSerializationEngineError
30
+ end
31
+
32
+ # @param engine [Base::AbstractEngine]
33
+ # @param config [XML::Config]
34
+ # @return [XML::Packer]
35
+ #
36
+ # @api private
37
+ # @since 0.4.0
38
+ def build_packer(engine, _config)
39
+ Packer.new(engine)
40
+ end
41
+
42
+ # @param engine [Base::AbstractEngine]
43
+ # @param config [XML::Config]
44
+ # @return [XML::Unpacker]
45
+ #
46
+ # @api private
47
+ # @since 0.4.0
48
+ def build_unpacker(engine, _config)
49
+ Unpacker.new(engine)
50
+ end
51
+
52
+ # @param engine [Base::AbstractEngine]
53
+ # @param config [XML::Config]
54
+ # @param packer [XML::Packer]
55
+ # @param unpacker [XML::Unpacker]
56
+ # @return [XML]
57
+ #
58
+ # @api private
59
+ # @since 0.4.0
60
+ def create_adapter(engine, config, packer, unpacker)
61
+ XML.new(engine, config, packer, unpacker)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers
4
+ class XML
5
+ # @api private
6
+ # @since 0.4.0
7
+ class Packer < Base::DataTransformer
8
+ # @param event [EvilEvents::Core::Events::AbstractEvent]
9
+ # @raise [EvilEvents::XMLSerializationError]
10
+ # @return [String]
11
+ #
12
+ # @see Base::DataTransformer
13
+ #
14
+ # @api private
15
+ # @since 0.4.0
16
+ def call(event)
17
+ unless event.is_a?(EvilEvents::Core::Events::AbstractEvent)
18
+ raise EvilEvents::XMLSerializationError
19
+ end
20
+
21
+ serialization_state = build_serialization_state(event)
22
+ engine.dump(serialization_state)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ class EvilEvents::Core::Events::Serializers
4
+ class XML
5
+ # @api private
6
+ # @since 0.4.0
7
+ class Unpacker < Base::DataTransformer
8
+ # @param serialized_event [String]
9
+ # @raise [EvilEvents::XMLDeserializationError]
10
+ # @return [EvilEvents::Core::Events::AbstractEvent]
11
+ #
12
+ # @see Base::DataTransformer
13
+ #
14
+ # @api private
15
+ # @since 0.4.0
16
+ def call(serialized_event)
17
+ raise EvilEvents::XMLDeserializationError unless serialized_event.is_a?(String)
18
+ serialization_state = engine.load(serialized_event)
19
+ raise EvilEvents::XMLDeserializationError unless serialization_state.valid?
20
+ restore_event_instance(serialization_state)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,17 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class EvilEvents::Core::Events::Subscriber
4
+ # rubocop:disable Metrics/BlockLength
5
+
4
6
  # @api public
5
7
  # @since 0.1.0
6
8
  Mixin = EvilEvents::Shared::ClonableModuleBuilder.build do
7
- # @param event_type [Array<String, Class{EvilEvents::Core::Events::AbstractEvent}, Regexp>]
8
- # @param delegator [String, Symbol, NilClass]
9
+ # @param event_types [Array<String, Class{EvilEvents::Core::Events::AbstractEvent}, Regexp>]
10
+ # @option delegator [String, Symbol, NilClass]
9
11
  # @raise [EvilEvents::ArgumentError]
12
+ # @return [void]
10
13
  #
11
14
  # @since 0.2.0
12
15
  def subscribe_to(*event_types, delegator: nil)
13
16
  raise EvilEvents::ArgumentError unless event_types.all? do |event_type|
14
- event_type.is_a?(Class) ||
17
+ event_type.is_a?(Class) ||
15
18
  event_type.is_a?(String) ||
16
19
  event_type.is_a?(Regexp) ||
17
20
  event_type.is_a?(Proc)
@@ -28,5 +31,25 @@ class EvilEvents::Core::Events::Subscriber
28
31
  end
29
32
  end
30
33
  end
34
+
35
+ # @param event_scopes [Array<String>]
36
+ # @option delegator [String,Symbol,NilClass]
37
+ # @raise [EvilEvents::ArgumentError]
38
+ # @return [void]
39
+ #
40
+ # @api public
41
+ # @since 0.4.0
42
+ def subscribe_to_scope(*event_scopes, delegator: nil)
43
+ raise EvilEvents::ArgumentError unless event_scopes.all? do |event_scope|
44
+ event_scope.is_a?(String)
45
+ end
46
+
47
+ event_system = EvilEvents::Core::Bootstrap[:event_system]
48
+
49
+ event_scopes.each do |event_scope|
50
+ event_system.scoped_observe(event_scope, self, delegator)
51
+ end
52
+ end
31
53
  end
54
+ # rubocop:enable Metrics/BlockLength
32
55
  end
@@ -17,6 +17,8 @@ module EvilEvents::Core
17
17
  include Mocking
18
18
 
19
19
  # @see EvilEvents::Core::System::Broadcaster
20
+ #
21
+ # @api private
20
22
  # @since 0.1.0
21
23
  def_delegators :broadcaster,
22
24
  :emit,
@@ -27,12 +29,15 @@ module EvilEvents::Core
27
29
  :restart_event_notifier
28
30
 
29
31
  # @see EvilEvents::Core::System::EventManager
32
+ #
33
+ # @api private
30
34
  # @since 0.1.0
31
35
  def_delegators :event_manager,
32
36
  :observe,
33
37
  :raw_observe,
34
38
  :observe_list,
35
39
  :conditional_observe,
40
+ :scoped_observe,
36
41
  :observers,
37
42
  :register_event_class,
38
43
  :unregister_event_class,
@@ -44,14 +49,24 @@ module EvilEvents::Core
44
49
  :managed_event?
45
50
 
46
51
  # @see EvilEvents::Core::System::EventBuilder
52
+ #
53
+ # @api private
47
54
  # @since 0.1.0
48
- def_delegators 'EvilEvents::Core::System::EventBuilder',
55
+ def_delegators :event_builder,
49
56
  :define_event_class,
50
57
  :define_abstract_event_class,
51
58
  :deserialize_from_json,
52
- :deserialize_from_hash
59
+ :deserialize_from_hash,
60
+ :deserialize_from_xml,
61
+ :deserialize_from_msgpack,
62
+ :serialize_to_json,
63
+ :serialize_to_hash,
64
+ :serialize_to_msgpack,
65
+ :serialize_to_xml
53
66
 
54
67
  # @see EvilEvents::Core::System::TypeManager
68
+ #
69
+ # @api private
55
70
  # @since 0.2.0
56
71
  def_delegators :type_manager,
57
72
  :register_converter,
@@ -59,21 +74,32 @@ module EvilEvents::Core
59
74
 
60
75
  # @return [EvilEvents::Core::System::Broadcaster]
61
76
  #
77
+ # @api private
62
78
  # @since 0.1.0
63
79
  attr_reader :broadcaster
64
80
 
65
81
  # @return [EvilEvents::Core::System::EventManager]
66
82
  #
83
+ # @api private
67
84
  # @since 0.1.0
68
85
  attr_reader :event_manager
69
86
 
70
87
  # @return [EvilEvents::Core::System::TypeManager]
71
88
  #
89
+ # @api private
72
90
  # @since 0.2.0
73
91
  attr_reader :type_manager
74
92
 
93
+ # @return [EvilEvents::Core::System::EventBuilder]
94
+ #
95
+ # @api private
96
+ # @since 0.4.0
97
+ attr_reader :event_builder
98
+
99
+ # @api private
75
100
  # @since 0.1.0
76
101
  def initialize
102
+ @event_builder = EventBuilder.new
77
103
  @broadcaster = Broadcaster.new
78
104
  @event_manager = EventManager.new
79
105
  @type_manager = TypeManager.new
@@ -29,20 +29,26 @@ class EvilEvents::Core::System
29
29
  end
30
30
 
31
31
  # @param event [EvilEvents::Core::Events::AbstractEvent]
32
+ # @option adapter [Symbol,NilClass]
32
33
  # @return void
33
34
  #
34
35
  # @since 0.1.0
35
- def emit(event)
36
- event_emitter.emit(event)
36
+ def emit(event, adapter: nil)
37
+ event_emitter.emit(event, adapter: adapter)
37
38
  end
38
39
 
39
40
  # @param event_type [String]
40
- # @param event_attributes [Hash]
41
+ # @option id [NilClass,String]
42
+ # @option payload [Hash]
43
+ # @option metadata [Hash]
44
+ # @option adapter [Symbol,NilClass]
41
45
  # @return void
42
46
  #
43
47
  # @since 0.1.0
44
- def raw_emit(event_type, **event_attributes)
45
- event_emitter.raw_emit(event_type, **event_attributes)
48
+ def raw_emit(event_type, id: nil, payload: {}, metadata: {}, adapter: nil)
49
+ event_emitter.raw_emit(
50
+ event_type, id: id, payload: payload, metadata: metadata, adapter: adapter
51
+ )
46
52
  end
47
53
 
48
54
  # @param adapter_name [Symbol, String]
@@ -3,40 +3,104 @@
3
3
  class EvilEvents::Core::System
4
4
  # @api private
5
5
  # @since 0.1.0
6
- module EventBuilder
7
- class << self
8
- # @param event_type [String]
9
- # @param event_class_definitions [Proc]
10
- # @return [Class{EvilEvents::Core::Events::AbstractEvent}]
11
- #
12
- # @since 0.1.0
13
- def define_event_class(event_type, &event_class_definitions)
14
- EvilEvents::Core::Events::EventFactory.create_class(event_type, &event_class_definitions)
15
- end
16
-
17
- # @param event_type [String]
18
- # @return [Class{EvilEvents::Core::Events::AbstractEvent}]
19
- #
20
- # @since 0.1.0
21
- def define_abstract_event_class(event_type)
22
- EvilEvents::Core::Events::EventFactory.create_abstract_class(event_type)
23
- end
24
-
25
- # @param serialized_event [String]
26
- # @return [EvilEvents::Core::Events::AbstractEvent]
27
- #
28
- # @since 0.1.0
29
- def deserialize_from_json(serialized_event)
30
- EvilEvents::Core::Events::Serializers[:json].deserialize(serialized_event)
31
- end
32
-
33
- # @param serialized_event [Hash]
34
- # @return [EvilEvents::Core::Events::AbstractEvent]
35
- #
36
- # @since 0.1.0
37
- def deserialize_from_hash(serialized_event)
38
- EvilEvents::Core::Events::Serializers[:hash].deserialize(serialized_event)
39
- end
6
+ class EventBuilder
7
+ # @return [EvilEvents::Core::Events::Serializers]
8
+ #
9
+ # @api private
10
+ # @since 0.4.0
11
+ attr_reader :serializers_container
12
+
13
+ # @api private
14
+ # @since 0.4.0
15
+ def initialize
16
+ @serializers_container = EvilEvents::Core::Events::Serializers.new
17
+
18
+ @serializers_container.register_core_serializers!
19
+ end
20
+
21
+ # @param event_type [String]
22
+ # @param event_class_definitions [Proc]
23
+ # @return [Class{EvilEvents::Core::Events::AbstractEvent}]
24
+ #
25
+ # @since 0.1.0
26
+ def define_event_class(event_type, &event_class_definitions)
27
+ EvilEvents::Core::Events::EventFactory.create_class(event_type, &event_class_definitions)
28
+ end
29
+
30
+ # @param event_type [String]
31
+ # @return [Class{EvilEvents::Core::Events::AbstractEvent}]
32
+ #
33
+ # @since 0.1.0
34
+ def define_abstract_event_class(event_type)
35
+ EvilEvents::Core::Events::EventFactory.create_abstract_class(event_type)
36
+ end
37
+
38
+ # @param event [EvilEvents::Core::Events::AbstractEvent]
39
+ # @return [::Hash]
40
+ #
41
+ # @api private
42
+ # @since 0.4.0
43
+ def serialize_to_hash(event)
44
+ serializers_container.resolve(:hash).serialize(event)
45
+ end
46
+
47
+ # @param event [EvilEvents::Core::Events::AbstractEvent]
48
+ # @return [::String]
49
+ #
50
+ # @api private
51
+ # @since 0.4.0
52
+ def serialize_to_json(event)
53
+ serializers_container.resolve(:json).serialize(event)
54
+ end
55
+
56
+ # @param event [EvilEvents::Core::Events::AbstractEvent]
57
+ # @return [::String]
58
+ #
59
+ # @api private
60
+ # @since 0.4.0
61
+ def serialize_to_xml(event)
62
+ serializers_container.resolve(:xml).serialize(event)
63
+ end
64
+
65
+ # @param event [EvilEvents::Core::Events::AbstractEvent]
66
+ # @return [::String]
67
+ #
68
+ # @api private
69
+ # @since 0.4.0
70
+ def serialize_to_msgpack(event)
71
+ serializers_container.resolve(:msgpack).serialize(event)
72
+ end
73
+
74
+ # @param serialized_event [String]
75
+ # @return [EvilEvents::Core::Events::AbstractEvent]
76
+ #
77
+ # @since 0.1.0
78
+ def deserialize_from_json(serialized_event)
79
+ serializers_container.resolve(:json).deserialize(serialized_event)
80
+ end
81
+
82
+ # @param serialized_event [Hash]
83
+ # @return [EvilEvents::Core::Events::AbstractEvent]
84
+ #
85
+ # @since 0.1.0
86
+ def deserialize_from_hash(serialized_event)
87
+ serializers_container.resolve(:hash).deserialize(serialized_event)
88
+ end
89
+
90
+ # @param serialized_event [String]
91
+ # @return [EvilEvents::Core::Events::AbstractEvent]
92
+ #
93
+ # @since 0.4.0
94
+ def deserialize_from_xml(serialized_event)
95
+ serializers_container.resolve(:xml).deserialize(serialized_event)
96
+ end
97
+
98
+ # @param serialized_event [String]
99
+ # @return [EvilEvents::Core::Events::AbstractEvent]
100
+ #
101
+ # @since 0.4.0
102
+ def deserialize_from_msgpack(serialized_event)
103
+ serializers_container.resolve(:msgpack).deserialize(serialized_event)
40
104
  end
41
105
  end
42
106
  end