Module: Messaging::StreamName
- Extended by:
- StreamName
- Included in:
- Controls::StreamName::NamedCategory::Example, StreamName
- Defined in:
- lib/messaging/stream_name.rb
Constant Summary collapse
- Error =
Class.new(RuntimeError)
Class Method Summary collapse
- .category?(stream_name) ⇒ Boolean
- .get_cardinal_id(stream_name) ⇒ Object
- .get_category(stream_name) ⇒ Object
- .get_entity_name(stream_name) ⇒ Object
- .get_id(stream_name) ⇒ Object
- .get_ids(stream_name) ⇒ Object
- .get_type(stream_name) ⇒ Object
- .get_types(stream_name) ⇒ Object
- .included(cls) ⇒ Object
Instance Method Summary collapse
- #category_stream_name(category = nil, type: nil, types: nil) ⇒ Object
- #command_category_stream_name(category = nil, type: nil, types: nil) ⇒ Object
- #command_stream_name(id, category = nil, type: nil, types: nil) ⇒ Object
- #stream_name(stream_id = nil, stream_category = nil, category: nil, cardinal_id: nil, id: nil, ids: nil, type: nil, types: nil) ⇒ Object
Class Method Details
.category?(stream_name) ⇒ Boolean
62 63 64 |
# File 'lib/messaging/stream_name.rb', line 62 def self.category?(stream_name) MessageStore::StreamName.category?(stream_name) end |
.get_cardinal_id(stream_name) ⇒ Object
78 79 80 |
# File 'lib/messaging/stream_name.rb', line 78 def self.get_cardinal_id(stream_name) MessageStore::StreamName.get_cardinal_id(stream_name) end |
.get_category(stream_name) ⇒ Object
58 59 60 |
# File 'lib/messaging/stream_name.rb', line 58 def self.get_category(stream_name) MessageStore::StreamName.get_category(stream_name) end |
.get_entity_name(stream_name) ⇒ Object
66 67 68 |
# File 'lib/messaging/stream_name.rb', line 66 def self.get_entity_name(stream_name) MessageStore::StreamName.get_entity_name(stream_name) end |
.get_id(stream_name) ⇒ Object
70 71 72 |
# File 'lib/messaging/stream_name.rb', line 70 def self.get_id(stream_name) MessageStore::StreamName.get_id(stream_name) end |
.get_ids(stream_name) ⇒ Object
74 75 76 |
# File 'lib/messaging/stream_name.rb', line 74 def self.get_ids(stream_name) MessageStore::StreamName.get_ids(stream_name) end |
.get_type(stream_name) ⇒ Object
82 83 84 |
# File 'lib/messaging/stream_name.rb', line 82 def self.get_type(stream_name) MessageStore::StreamName.get_type(stream_name) end |
.get_types(stream_name) ⇒ Object
86 87 88 |
# File 'lib/messaging/stream_name.rb', line 86 def self.get_types(stream_name) MessageStore::StreamName.get_types(stream_name) end |
Instance Method Details
#category_stream_name(category = nil, type: nil, types: nil) ⇒ Object
33 34 35 36 |
# File 'lib/messaging/stream_name.rb', line 33 def category_stream_name(category=nil, type: nil, types: nil) category ||= self.category MessageStore::StreamName.stream_name(category, type: type, types: types) end |
#command_category_stream_name(category = nil, type: nil, types: nil) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/messaging/stream_name.rb', line 50 def command_category_stream_name(category=nil, type: nil, types: nil) category ||= self.category types ||= [] types.unshift('command') types << type unless type == nil MessageStore::StreamName.stream_name(category, types: types) end |
#command_stream_name(id, category = nil, type: nil, types: nil) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/messaging/stream_name.rb', line 38 def command_stream_name(id, category=nil, type: nil, types: nil) if id == nil raise Error, "ID must not be omitted from command stream name" end category ||= self.category types ||= [] types.unshift('command') types << type unless type == nil MessageStore::StreamName.stream_name(category, id, types: types) end |
#stream_name(stream_id = nil, stream_category = nil, category: nil, cardinal_id: nil, id: nil, ids: nil, type: nil, types: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/messaging/stream_name.rb', line 16 def stream_name(stream_id=nil, stream_category=nil, category: nil, cardinal_id: nil, id: nil, ids: nil, type: nil, types: nil) if stream_id.nil? && cardinal_id.nil? && id.nil? && ids.nil? raise Error, "ID must not be omitted from stream name" end stream_category ||= category if stream_category.nil? if not self.respond_to?(:category) raise Error, "Category must not be omitted from stream name" else stream_category = self.category end end MessageStore::StreamName.stream_name(stream_category, stream_id, cardinal_id: cardinal_id, id: id, ids: ids, type: type, types: types) end |