Module: Messaging::StreamName
- Extended by:
- StreamName
- Included in:
- Controls::StreamName::Named::Example, StreamName
- Defined in:
- lib/messaging/stream_name.rb
Constant Summary collapse
- Error =
Class.new(RuntimeError)
Class Method Summary collapse
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(id, category = nil, type: nil, types: nil) ⇒ Object
Class Method Details
.get_category(stream_name) ⇒ Object
50 51 52 |
# File 'lib/messaging/stream_name.rb', line 50 def self.get_category(stream_name) MessageStore::StreamName.get_category(stream_name) end |
.get_id(stream_name) ⇒ Object
54 55 56 |
# File 'lib/messaging/stream_name.rb', line 54 def self.get_id(stream_name) MessageStore::StreamName.get_id(stream_name) end |
Instance Method Details
#category_stream_name(category = nil, type: nil, types: nil) ⇒ Object
25 26 27 28 |
# File 'lib/messaging/stream_name.rb', line 25 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
42 43 44 45 46 47 48 |
# File 'lib/messaging/stream_name.rb', line 42 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
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/messaging/stream_name.rb', line 30 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(id, category = nil, type: nil, types: nil) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/messaging/stream_name.rb', line 16 def stream_name(id, category=nil, type: nil, types: nil) if id == nil raise Error, "ID must not be omitted from stream name" end category ||= self.category MessageStore::StreamName.stream_name(category, id, type: type, types: types) end |