Module: Messaging::Postgres::StreamName

Extended by:
StreamName
Included in:
Controls::StreamName::Named::Example, StreamName
Defined in:
lib/messaging/postgres/stream_name.rb

Defined Under Namespace

Modules: Macro

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.activateObject



10
11
12
13
14
15
# File 'lib/messaging/postgres/stream_name.rb', line 10

def self.activate
  target_class ||= Object
  macro_module = Macro
  return if target_class.is_a? macro_module
  target_class.extend(macro_module)
end

.get_category(stream_name) ⇒ Object



51
52
53
# File 'lib/messaging/postgres/stream_name.rb', line 51

def self.get_category(stream_name)
  EventSource::Postgres::StreamName.get_category(stream_name)
end

.get_id(stream_name) ⇒ Object



55
56
57
# File 'lib/messaging/postgres/stream_name.rb', line 55

def self.get_id(stream_name)
  EventSource::Postgres::StreamName.get_id stream_name
end

.included(cls) ⇒ Object



6
7
8
# File 'lib/messaging/postgres/stream_name.rb', line 6

def self.included(cls)
  cls.extend Macro
end

Instance Method Details

#category_stream_name(category = nil) ⇒ Object



36
37
38
39
# File 'lib/messaging/postgres/stream_name.rb', line 36

def category_stream_name(category=nil)
  category ||= self.category
  category
end

#command_category_stream_name(category = nil) ⇒ Object



46
47
48
49
# File 'lib/messaging/postgres/stream_name.rb', line 46

def command_category_stream_name(category=nil)
  category ||= self.category
  EventSource::Postgres::StreamName.stream_name(category, type: 'command')
end

#command_stream_name(id, category = nil) ⇒ Object



41
42
43
44
# File 'lib/messaging/postgres/stream_name.rb', line 41

def command_stream_name(id, category=nil)
  category ||= self.category
  EventSource::Postgres::StreamName.stream_name(category, id, type: 'command')
end

#stream_name(id, category = nil, type: nil) ⇒ Object



31
32
33
34
# File 'lib/messaging/postgres/stream_name.rb', line 31

def stream_name(id, category=nil, type: nil)
  category ||= self.category
  EventSource::Postgres::StreamName.stream_name(category, id, type: type)
end