Class: Rooq::DefaultConnectionProvider
- Inherits:
-
ConnectionProvider
- Object
- ConnectionProvider
- Rooq::DefaultConnectionProvider
- Defined in:
- lib/rooq/connection.rb
Overview
A connection provider that wraps a single connection. The connection lifecycle is managed externally by the caller. Release is a no-op - the connection stays open until closed externally.
Use this when you want to control transactions and connection lifecycle yourself.
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
-
#acquire ⇒ Object
Always returns the same connection instance.
-
#initialize(connection) ⇒ DefaultConnectionProvider
constructor
A new instance of DefaultConnectionProvider.
-
#release(connection) ⇒ Object
No-op - the connection lifecycle is managed externally.
Methods inherited from ConnectionProvider
Constructor Details
#initialize(connection) ⇒ DefaultConnectionProvider
Returns a new instance of DefaultConnectionProvider.
46 47 48 49 |
# File 'lib/rooq/connection.rb', line 46 def initialize(connection) super() @connection = connection end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
43 44 45 |
# File 'lib/rooq/connection.rb', line 43 def connection @connection end |
Instance Method Details
#acquire ⇒ Object
Always returns the same connection instance.
53 54 55 |
# File 'lib/rooq/connection.rb', line 53 def acquire @connection end |
#release(connection) ⇒ Object
No-op - the connection lifecycle is managed externally.
59 60 61 |
# File 'lib/rooq/connection.rb', line 59 def release(connection) # No-op: connection lifecycle is managed externally end |