evt-event_source 0.18.2.1 → 0.19.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 +5 -1
- data/lib/event_source/stream.rb +9 -16
- data/lib/event_source/stream_name.rb +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2023c4a4fded3ae97318f828482cfa3a1984560
|
4
|
+
data.tar.gz: '07874a76c0b95e1bc4f7a7da7a3404e5738a7556'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6c814ec4314887fb5a92b42d5588aa49cf22fe6434b5e9e89318bee444fb948eac1a1285da114d63f9a3d05840d418e4bc7fe6ff7b55fcdbc578f249ce1a393
|
7
|
+
data.tar.gz: 6e84704a70a50dc4a4d854e9d2266d4b8394b4b4f0e94867a9c603293088520f9e61e7a665bf6bf0cab3debc0d7a1126c1de58b44fb6c1e6a7687ab5852b3b44
|
@@ -1,10 +1,14 @@
|
|
1
1
|
module EventSource
|
2
2
|
module Controls
|
3
3
|
module StreamName
|
4
|
-
def self.example(category: nil, id: nil, randomize_category: nil)
|
4
|
+
def self.example(category: nil, id: nil, type: 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
|
+
|
8
12
|
"#{category}-#{id}"
|
9
13
|
end
|
10
14
|
end
|
data/lib/event_source/stream.rb
CHANGED
@@ -2,30 +2,23 @@ module EventSource
|
|
2
2
|
class Stream
|
3
3
|
initializer :name
|
4
4
|
|
5
|
-
def self.
|
6
|
-
|
7
|
-
|
8
|
-
if name.start_with?(subtype)
|
9
|
-
return :stream
|
10
|
-
else
|
11
|
-
return subtype.to_sym
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.canonize(stream)
|
16
|
-
return stream if stream.is_a? self
|
17
|
-
|
18
|
-
new stream
|
5
|
+
def self.build(subject)
|
6
|
+
return subject if subject.is_a? self
|
7
|
+
new(subject)
|
19
8
|
end
|
20
9
|
|
21
|
-
def
|
22
|
-
@
|
10
|
+
def id
|
11
|
+
@id ||= StreamName.get_id(name)
|
23
12
|
end
|
24
13
|
|
25
14
|
def category
|
26
15
|
@category ||= StreamName.get_category(name)
|
27
16
|
end
|
28
17
|
|
18
|
+
def type
|
19
|
+
@type ||= StreamName.get_type(name)
|
20
|
+
end
|
21
|
+
|
29
22
|
def category?
|
30
23
|
@is_category ||= !name.include?('-')
|
31
24
|
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
module EventSource
|
2
2
|
module StreamName
|
3
|
-
|
3
|
+
def self.stream_name(category_name, id=nil, type: nil)
|
4
|
+
stream_name = category_name
|
5
|
+
stream_name = "#{stream_name}:#{type}" unless type.nil?
|
6
|
+
stream_name = "#{stream_name}-#{id}" unless id.nil?
|
4
7
|
|
5
|
-
|
6
|
-
"#{category_name}-#{id}"
|
8
|
+
stream_name
|
7
9
|
end
|
8
10
|
|
9
11
|
def self.get_id(stream_name)
|
@@ -14,5 +16,13 @@ module EventSource
|
|
14
16
|
def self.get_category(stream_name)
|
15
17
|
stream_name.split('-')[0]
|
16
18
|
end
|
19
|
+
|
20
|
+
def self.get_type(name)
|
21
|
+
type = name.split(':').last.split('-').first
|
22
|
+
|
23
|
+
return nil if name.start_with?(type)
|
24
|
+
|
25
|
+
type
|
26
|
+
end
|
17
27
|
end
|
18
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evt-event_source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.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-01-
|
11
|
+
date: 2017-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evt-casing
|