Class: Bundler::ConnectionPool::Wrapper
- Inherits:
-
BasicObject
- Defined in:
- lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb
Constant Summary
collapse
- METHODS =
[:with, :pool_shutdown, :wrapped_pool]
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}, &block) ⇒ Wrapper
Returns a new instance of Wrapper.
5
6
7
|
# File 'lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb', line 5
def initialize(options = {}, &block)
@pool = options.fetch(:pool) { ::Bundler::ConnectionPool.new(options, &block) }
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
35
36
37
38
39
|
# File 'lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb', line 35
def method_missing(name, *args, **kwargs, &block)
with do |connection|
connection.send(name, *args, **kwargs, &block)
end
end
|
Instance Method Details
#pool_available ⇒ Object
25
26
27
|
# File 'lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb', line 25
def pool_available
@pool.available
end
|
#pool_shutdown(&block) ⇒ Object
17
18
19
|
# File 'lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb', line 17
def pool_shutdown(&block)
@pool.shutdown(&block)
end
|
#pool_size ⇒ Object
21
22
23
|
# File 'lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb', line 21
def pool_size
@pool.size
end
|
#respond_to?(id, *args) ⇒ Boolean
29
30
31
|
# File 'lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb', line 29
def respond_to?(id, *args)
METHODS.include?(id) || with { |c| c.respond_to?(id, *args) }
end
|
#with(&block) ⇒ Object
13
14
15
|
# File 'lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb', line 13
def with(&block)
@pool.with(&block)
end
|
#wrapped_pool ⇒ Object
9
10
11
|
# File 'lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb', line 9
def wrapped_pool
@pool
end
|