evt-event_source 0.21.0.0 → 0.22.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: c07ab23b9cdab1727b295c3a4c62852eaca8bd0e
4
- data.tar.gz: b4a4eb08ca7951c7d2d9a5503ba675a7673e7525
3
+ metadata.gz: 2635e23e0ecacfc5666d8d5e80d1c57bd167a16f
4
+ data.tar.gz: c0342b2d57eec7c3539c6892f2e7b16fcab046ba
5
5
  SHA512:
6
- metadata.gz: d991692faa442fc677b0bdf76caaa25aa4dfae4429ac3f3bcf731b5ec1e012b26e7adfbf556d14e46251eb1f1b63f5c2c2b5c5389232f3961966d85547fcc104
7
- data.tar.gz: 2a9e1151cde3dc5b55bede1a631ea42c4c98a0a3ab9fb705b17699a18d6ceaa30045b56d9909103342f9f641a211fdbfd06c79bf3d2c3af418884c624de864f2
6
+ metadata.gz: f94434548f87dfa7f2a04ca56a9b664ea47175588c870526d1dde460f1466f5c926c371ed5cd54be5ed4bc8875565622e7f076e80369d8d3b352d6cc74669b72
7
+ data.tar.gz: 32adf3b9e286ceaf3d7ddb3d57eea053fec80aecd264ab1ec836e9e5c0942e055df40fa2870a4319fb73d8de9ba1b4b74e7b4e2174ce6fbcc19b322a36861a95
@@ -1,15 +1,11 @@
1
1
  module EventSource
2
2
  module Controls
3
3
  module StreamName
4
- def self.example(category: nil, id: nil, type: nil, randomize_category: nil)
4
+ def self.example(category: nil, id: nil, type: nil, types: nil, randomize_category: nil)
5
5
  category ||= Category.example(category: category, randomize_category: randomize_category)
6
6
  id ||= Identifier::UUID.random
7
7
 
8
- unless type.nil?
9
- category = "#{category}:#{type}"
10
- end
11
-
12
- "#{category}-#{id}"
8
+ EventSource::StreamName.stream_name(category, id, type: type, types: types)
13
9
  end
14
10
  end
15
11
  end
@@ -1,8 +1,14 @@
1
1
  module EventSource
2
2
  module StreamName
3
- def self.stream_name(category_name, id=nil, type: nil)
3
+ def self.stream_name(category_name, id=nil, type: nil, types: nil)
4
+ types = Array(types)
5
+ types.unshift(type) unless type.nil?
6
+
7
+ type_list = nil
8
+ type_list = types.join('+') unless types.empty?
9
+
4
10
  stream_name = category_name
5
- stream_name = "#{stream_name}:#{type}" unless type.nil?
11
+ stream_name = "#{stream_name}:#{type_list}" unless type_list.nil?
6
12
  stream_name = "#{stream_name}-#{id}" unless id.nil?
7
13
 
8
14
  stream_name
@@ -21,12 +27,20 @@ module EventSource
21
27
  !stream_name.include?('-')
22
28
  end
23
29
 
24
- def self.get_type(name)
30
+ def self.get_type_list(name)
25
31
  type = name.split(':').last.split('-').first
26
32
 
27
33
  return nil if name.start_with?(type)
28
34
 
29
35
  type
30
36
  end
37
+
38
+ def self.get_types(name)
39
+ type_list = get_type_list(name)
40
+
41
+ return [] if type_list.nil?
42
+
43
+ type_list.split('+')
44
+ end
31
45
  end
32
46
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-event_source
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0.0
4
+ version: 0.22.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project