Class: PgDice::PartitionListerFactory

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pgdice/partition_lister_factory.rb

Overview

PartitionListerFactory is a class used to build PartitionListers

Instance Method Summary collapse

Constructor Details

#initialize(configuration, opts = {}) ⇒ PartitionListerFactory

Returns a new instance of PartitionListerFactory.



11
12
13
14
15
16
# File 'lib/pgdice/partition_lister_factory.rb', line 11

def initialize(configuration, opts = {})
  @configuration = configuration
  @query_executor = opts[:query_executor] ||= lambda do |sql|
    database_connection.execute(sql).values.flatten
  end
end

Instance Method Details

#callObject



18
19
20
# File 'lib/pgdice/partition_lister_factory.rb', line 18

def call
  PgDice::PartitionLister.new(query_executor: @query_executor)
end