Class: Vault::ConnectionPool::Wrapper

Inherits:
BasicObject
Defined in:
lib/vault/vendor/connection_pool.rb

Constant Summary collapse

METHODS =
[:with, :pool_shutdown]

Instance Method Summary collapse

Constructor Details

#initialize(options = {}, &block) ⇒ Wrapper

Returns a new instance of Wrapper.



130
131
132
# File 'lib/vault/vendor/connection_pool.rb', line 130

def initialize(options = {}, &block)
  @pool = ::ConnectionPool.new(options, &block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



146
147
148
149
150
# File 'lib/vault/vendor/connection_pool.rb', line 146

def method_missing(name, *args, &block)
  with do |connection|
    connection.send(name, *args, &block)
  end
end

Instance Method Details

#pool_shutdown(&block) ⇒ Object



138
139
140
# File 'lib/vault/vendor/connection_pool.rb', line 138

def pool_shutdown(&block)
  @pool.shutdown(&block)
end

#respond_to?(id, *args) ⇒ Boolean

Returns:

  • (Boolean)


142
143
144
# File 'lib/vault/vendor/connection_pool.rb', line 142

def respond_to?(id, *args)
  METHODS.include?(id) || with { |c| c.respond_to?(id, *args) }
end

#with(&block) ⇒ Object



134
135
136
# File 'lib/vault/vendor/connection_pool.rb', line 134

def with(&block)
  @pool.with(&block)
end