Class: PgDice::DatabaseConnectionFactory
- Inherits:
-
Object
- Object
- PgDice::DatabaseConnectionFactory
- Extended by:
- Forwardable
- Defined in:
- lib/pgdice/database_connection_factory.rb
Overview
DatabaseConnectionFactory is a class used to build DatabaseConnections
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(configuration, opts = {}) ⇒ DatabaseConnectionFactory
constructor
A new instance of DatabaseConnectionFactory.
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
#call ⇒ Object
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 |