evt-messaging-postgres 0.5.1.0 → 0.6.0.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
  SHA1:
3
- metadata.gz: c365fc5ad60ea268d22d4399f53b98c70f1a3b91
4
- data.tar.gz: 1d4f8de7a3832a9b4c0f303988c6319847d12ea4
3
+ metadata.gz: 8786da31533ad8571ca2f4af5285070fe3bd4383
4
+ data.tar.gz: ffb9f35b70af3ae69df95c1988726a598ea9f8e0
5
5
  SHA512:
6
- metadata.gz: 04d1b8869720cc4f81257cfc93469840042cfb375f8a087bda62d4949b6e5c52774ad4b4185fe263fc9db2e481d89fbf361e035562c7427448bbebf06a955a4c
7
- data.tar.gz: 8c8a708ac84668fe8bcaabe9bcfe571fb7b99ab32f56b8df2d6d2071e9e02ae065ee7cf828b7ee90688cab91b63f4262cc675956be2ded100bb147d6661df0fe
6
+ metadata.gz: cdd978e7b09a994f1c36064dd714da540eecf3e80eabe3491a790d0a3db0f3c839a5e4de2d012e9b76793771b4ca38f6aafa89814f7f62f51d496293ae8ec1bc
7
+ data.tar.gz: 335f52ba47f31994d4f0862c829ddcf35dde09adb4c6e11cdeb3e0ef1b776d735b753d47bfb7d4b61ccbdd15a3f7f4b1ca65a2d235ce2502d845779a311a503b
@@ -1,7 +1,7 @@
1
1
  module Messaging
2
2
  module Postgres
3
3
  module Controls
4
- StreamName = Messaging::Controls::StreamName
4
+ StreamName = EventSource::Postgres::Controls::StreamName
5
5
 
6
6
  module StreamName
7
7
  module Named
@@ -1,3 +1,4 @@
1
+ require 'event_source/postgres/controls'
1
2
  require 'messaging/controls'
2
3
 
3
4
  require 'messaging/postgres/controls/stream_name'
@@ -1,23 +1,59 @@
1
1
  module Messaging
2
2
  module Postgres
3
3
  module StreamName
4
+ extend self
5
+
4
6
  def self.included(cls)
5
- cls.class_exec do
6
- include Messaging::StreamName
7
+ cls.extend Macro
8
+ end
9
+
10
+ def self.activate
11
+ target_class ||= Object
12
+ macro_module = Macro
13
+ return if target_class.is_a? macro_module
14
+ target_class.extend(macro_module)
15
+ end
16
+
17
+ module Macro
18
+ def category_macro(category)
19
+ category = Casing::Camel.(category, symbol_to_string: true)
20
+ self.send :define_method, :category do
21
+ @category ||= category
22
+ end
23
+
24
+ self.send :define_method, :category= do |category|
25
+ @category = category
26
+ end
7
27
  end
28
+ alias :category :category_macro
8
29
  end
9
30
 
10
- extend self
11
- extend Messaging::StreamName
31
+ def stream_name(id, category=nil, type: nil)
32
+ category ||= self.category
33
+ EventSource::Postgres::StreamName.stream_name(category, id, type: type)
34
+ end
12
35
 
13
36
  def category_stream_name(category=nil)
14
37
  category ||= self.category
15
38
  category
16
39
  end
17
40
 
41
+ def command_stream_name(id, category=nil)
42
+ category ||= self.category
43
+ EventSource::Postgres::StreamName.stream_name(category, id, type: 'command')
44
+ end
45
+
18
46
  def command_category_stream_name(category=nil)
19
47
  category ||= self.category
20
- EventSource::StreamName.stream_name category, type: 'command'
48
+ EventSource::Postgres::StreamName.stream_name(category, type: 'command')
49
+ end
50
+
51
+ def self.get_category(stream_name)
52
+ EventSource::Postgres::StreamName.get_category(stream_name)
53
+ end
54
+
55
+ def self.get_id(stream_name)
56
+ EventSource::Postgres::StreamName.get_id stream_name
21
57
  end
22
58
  end
23
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-messaging-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1.0
4
+ version: 0.6.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: 2017-02-01 00:00:00.000000000 Z
11
+ date: 2017-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evt-messaging