Class: PgDice::DatabaseConnectionFactory

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

Overview

DatabaseConnectionFactory is a class used to build DatabaseConnections

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of DatabaseConnectionFactory.



11
12
13
14
# File 'lib/pgdice/database_connection_factory.rb', line 11

def initialize(configuration, opts = {})
  @configuration = configuration
  @query_executor_factory = opts[:query_executor_factory] ||= PgDice::QueryExecutorFactory.new(configuration, opts)
end

Instance Method Details

#callObject



16
17
18
# File 'lib/pgdice/database_connection_factory.rb', line 16

def call
  PgDice::DatabaseConnection.new(logger: logger, query_executor: @query_executor_factory.call, dry_run: dry_run)
end