Class: Messaging::Adapters::Postgres::Category

Inherits:
Object
  • Object
show all
Extended by:
Dry::Initializer
Defined in:
lib/messaging/adapters/postgres/category.rb

Direct Known Subclasses

CategoryWithPartitions

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.table_name_for(name) ⇒ Object



10
11
12
# File 'lib/messaging/adapters/postgres/category.rb', line 10

def self.table_name_for(name)
  name.parameterize(separator: '_')
end

Instance Method Details

#inspectObject



20
21
22
# File 'lib/messaging/adapters/postgres/category.rb', line 20

def inspect
  "#<Category: #{name}>"
end

#messagesActiveRecord::Relation

Access to all messages in the category sorted by created_at

Returns:

  • (ActiveRecord::Relation)


16
17
18
# File 'lib/messaging/adapters/postgres/category.rb', line 16

def messages
  SerializedMessage.where(stream_category: name).order(:created_at)
end

#to_sObject



24
25
26
# File 'lib/messaging/adapters/postgres/category.rb', line 24

def to_s
  name
end