Module: TableSaw::Connection

Defined in:
lib/table_saw/connection.rb

Class Method Summary collapse

Class Method Details

.poolObject



14
15
16
# File 'lib/table_saw/connection.rb', line 14

def self.pool
  @pool ||= ConnectionPool.new(size: 2) { PG::Connection.new(TableSaw.configuration.connection) }
end

.withObject

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/table_saw/connection.rb', line 8

def self.with
  raise ArgumentError, 'requires a block' unless block_given?

  pool.with { |conn| yield conn }
end