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 +4 -4
- data/lib/event_source/controls/stream_name.rb +2 -6
- data/lib/event_source/stream_name.rb +17 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2635e23e0ecacfc5666d8d5e80d1c57bd167a16f
|
4
|
+
data.tar.gz: c0342b2d57eec7c3539c6892f2e7b16fcab046ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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}:#{
|
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.
|
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
|