Module: EntitySnapshot::Postgres::StreamName

Extended by:
StreamName
Included in:
EntitySnapshot::Postgres, StreamName
Defined in:
lib/entity_snapshot/postgres/stream_name.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.category(entity_class, specifier = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/entity_snapshot/postgres/stream_name.rb', line 12

def self.category(entity_class, specifier=nil)
  *, entity_class_name = entity_class.name.split('::')

  entity_class_name = Casing::Camel.(entity_class_name)

  if specifier.nil?
    entity_class_name
  else
    "#{entity_class_name}#{specifier}"
  end
end

Instance Method Details

#snapshot_stream_name(id, category = nil) ⇒ Object



6
7
8
9
10
# File 'lib/entity_snapshot/postgres/stream_name.rb', line 6

def snapshot_stream_name(id, category=nil)
  category ||= self.category

  Messaging::StreamName.stream_name(id, category, type: 'snapshot')
end