Class: Flounder::Engine
- Inherits:
-
Object
- Object
- Flounder::Engine
- 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
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#connection_pool ⇒ ConnectionPool
readonly
Returns the connection pool.
Instance Method Summary collapse
- #exec(*args, &block) ⇒ Object
-
#initialize(connection_pool) ⇒ Engine
constructor
A new instance of Engine.
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
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
8 9 10 |
# File 'lib/flounder/engine.rb', line 8 def connection @connection end |
#connection_pool ⇒ ConnectionPool (readonly)
Returns the connection pool.
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 |