event_sorcerer 0.0.1 → 0.0.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
  SHA1:
3
- metadata.gz: 8f1f0fac682006f02615146ad4d6997e9ceeddb5
4
- data.tar.gz: ee90c449e367c4d6685f6fd7712b95a6236a939c
3
+ metadata.gz: d3a2387b8993e5a4c07e5a15d3e2f15a2a91bba3
4
+ data.tar.gz: 4f3bb03fdb88fc85b045347683b7aa9729a1df8d
5
5
  SHA512:
6
- metadata.gz: 1903c49e3cae9c1b11225c04c2fc6e8469e9475c8050945f62b8d4237548770d7306638bb176790815984da437b882f411ccf1d15c2dc765511fc07900f35430
7
- data.tar.gz: 6f2030bc699886797c125f21d3c304293723a9e79fc5eebd600ce5f93bacafbb08000627ea2c5ea71d71630e00f5f8a95a19d3187107d297160c626c167eba77
6
+ metadata.gz: 3b35be0ea6bf136cadfacec2f8962d0b93b962c87fbee70c74447b57e90f361c76ac7633ed087ca84838ef703e4564d995adca502558da6a763dcd30bc705cd0
7
+ data.tar.gz: 8426122f4f7e433c5f8a31ab5147c376edf2fce262b1afcd2129b14a22334362d23ee1fd6abefec674925bc7fab41d7c1b2f94f770d6711ece7c80d4413c2033
@@ -10,9 +10,16 @@ module EventSorcerer
10
10
  # Public: Creates a new UnitOfWork instance.
11
11
  def initialize
12
12
  @identity_map = {}
13
+ @meta = {}
13
14
  @pending_saves = []
14
15
  end
15
16
 
17
+ # Public: Add additional meta data to be sent along with any save reciepts
18
+ # on the message bus for the duration of the unit of work.
19
+ def add_meta_data(meta_hash)
20
+ meta.merge! meta_hash
21
+ end
22
+
16
23
  # Public: Executes all pending saves within a transaction, clears the
17
24
  # pending saves, and publishes the reciepts via the message bus.
18
25
  #
@@ -26,7 +33,7 @@ module EventSorcerer
26
33
 
27
34
  save_receipts.each do |reciept|
28
35
  message_bus.publish_events(reciept.id, reciept.klass, reciept.events,
29
- reciept.meta)
36
+ reciept.meta.merge(meta))
30
37
  end
31
38
 
32
39
  self
@@ -44,6 +51,8 @@ module EventSorcerer
44
51
 
45
52
  def handle_save(save)
46
53
  pending_saves << save
54
+
55
+ self
47
56
  end
48
57
 
49
58
  # Public: Stores an aggregate via it's ID into the identity map.
@@ -64,6 +73,9 @@ module EventSorcerer
64
73
  # Private: Returns the identity map Hash.
65
74
  attr_reader :identity_map
66
75
 
76
+ # Private: Returns extra metadata hash.
77
+ attr_reader :meta
78
+
67
79
  # Private: Returns the pending saves Array.
68
80
  attr_reader :pending_saves
69
81
  end
@@ -1,4 +1,4 @@
1
1
  # Public: Defines a constant for the current version number.
2
2
  module EventSorcerer
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_sorcerer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian Edwards