module Messaging module Adapters class Postgres class Categories class Row extend Dry::Initializer param :table_name param :type param :expression def category_class return CategoryWithPartitions if type == 'p' Category end def category_name regexp = /FOR VALUES IN \(\'(.*)\'\)/ expression.match(regexp)[1] end def to_category category_class.new(category_name, table_name) end end end end end end