Module: Pools::Pooled
- Extended by:
- ActiveSupport::Concern
- Included in:
- Cassandra::Pooled, Redis::Pooled
- Defined in:
- lib/pools/pooled.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#connection_pool ⇒ Object
readonly
Returns the value of attribute connection_pool.
-
#preparation_chain ⇒ Object
readonly
Returns the value of attribute preparation_chain.
Instance Method Summary collapse
- #__connection ⇒ Object
- #__disconnect(connection) ⇒ Object
- #__prepare(connection) ⇒ Object
- #initialize(*args) ⇒ Object
- #with_connection(&block) ⇒ Object
Instance Attribute Details
#connection_pool ⇒ Object (readonly)
Returns the value of attribute connection_pool.
7 8 9 |
# File 'lib/pools/pooled.rb', line 7 def connection_pool @connection_pool end |
#preparation_chain ⇒ Object (readonly)
Returns the value of attribute preparation_chain.
7 8 9 |
# File 'lib/pools/pooled.rb', line 7 def preparation_chain @preparation_chain end |
Instance Method Details
#__connection ⇒ Object
20 21 22 |
# File 'lib/pools/pooled.rb', line 20 def __connection # Override in parent end |
#__disconnect(connection) ⇒ Object
24 25 26 |
# File 'lib/pools/pooled.rb', line 24 def __disconnect(connection) # Override in parent end |
#__prepare(connection) ⇒ Object
28 29 30 |
# File 'lib/pools/pooled.rb', line 28 def __prepare(connection) @preparation_chain.each { |args| connection.send(*args) } end |
#initialize(*args) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/pools/pooled.rb', line 9 def initialize(*args) = args. @preparation_chain = [] @connection_pool = ConnectionPool.new(self, ) Pools.handler.add(@connection_pool, [:pool_name]) end |
#with_connection(&block) ⇒ Object
16 17 18 |
# File 'lib/pools/pooled.rb', line 16 def with_connection(&block) @connection_pool.with_connection(&block) end |