Class: Messaging::Adapters::Postgres::Categories::Row

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

Instance Method Summary collapse

Instance Method Details

#category_classObject



12
13
14
15
16
# File 'lib/messaging/adapters/postgres/categories/row.rb', line 12

def category_class
  return CategoryWithPartitions if type == 'p'

  Category
end

#category_nameObject



18
19
20
21
# File 'lib/messaging/adapters/postgres/categories/row.rb', line 18

def category_name
  regexp = /FOR VALUES IN \(\'(.*)\'\)/
  expression.match(regexp)[1]
end

#to_categoryObject



23
24
25
# File 'lib/messaging/adapters/postgres/categories/row.rb', line 23

def to_category
  category_class.new(category_name, table_name)
end