Class: Flounder::Engine

Inherits:
Object
  • Object
show all
Defined in:
lib/flounder/engine.rb

Overview

Intermediary class that arel wants us to create. Mostly supports the #connection_pool message returning our connection pool.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection_pool) ⇒ Engine

Returns a new instance of Engine.



10
11
12
13
14
15
# File 'lib/flounder/engine.rb', line 10

def initialize connection_pool
  @connection_pool = connection_pool
  # TBD This connection is currently never returned to the pool, Arel 
  # is designed that way. 
  @connection = connection_pool.checkout
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



8
9
10
# File 'lib/flounder/engine.rb', line 8

def connection
  @connection
end

#connection_poolConnectionPool (readonly)

Returns the connection pool.

Returns:



29
30
31
# File 'lib/flounder/engine.rb', line 29

def connection_pool
  @connection_pool
end

Instance Method Details

#exec(*args, &block) ⇒ Object



17
18
19
20
21
# File 'lib/flounder/engine.rb', line 17

def exec *args, &block
  connection_pool.with_connection do |conn|
    conn.exec *args, &block
  end
end