Class: HealthyPools::Wrapper
- Inherits:
-
BasicObject
- Defined in:
- lib/healthy_pools.rb
Constant Summary
collapse
- METHODS =
[:with, :pool_shutdown]
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}, &block) ⇒ Wrapper
Returns a new instance of Wrapper.
132
133
134
|
# File 'lib/healthy_pools.rb', line 132
def initialize(options = {}, &block)
@pool = options.fetch(:pool) { ::HealthyPools.new(options, &block) }
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
156
157
158
159
160
|
# File 'lib/healthy_pools.rb', line 156
def method_missing(name, *args, &block)
with do |connection|
connection.send(name, *args, &block)
end
end
|
Instance Method Details
#pool_available ⇒ Object
148
149
150
|
# File 'lib/healthy_pools.rb', line 148
def pool_available
@pool.available
end
|
#pool_shutdown(&block) ⇒ Object
140
141
142
|
# File 'lib/healthy_pools.rb', line 140
def pool_shutdown(&block)
@pool.shutdown(&block)
end
|
#pool_size ⇒ Object
144
145
146
|
# File 'lib/healthy_pools.rb', line 144
def pool_size
@pool.size
end
|
#respond_to?(id, *args) ⇒ Boolean
152
153
154
|
# File 'lib/healthy_pools.rb', line 152
def respond_to?(id, *args)
METHODS.include?(id) || with { |c| c.respond_to?(id, *args) }
end
|
#with(&block) ⇒ Object
136
137
138
|
# File 'lib/healthy_pools.rb', line 136
def with(&block)
@pool.with(&block)
end
|