class Spinel::ConnectionPoolProxy

Public Class Methods

new(pool) click to toggle source
# File lib/spinel/connection_pool_proxy.rb, line 3
def initialize pool
  raise ArgumentError, "Should only proxy ConnectionPool!" unless self.class.should_proxy?(pool)
  @pool = pool
end
proxy_if_needed(conn) click to toggle source
# File lib/spinel/connection_pool_proxy.rb, line 20
def self.proxy_if_needed(conn)
  should_proxy?(conn) ? self.new(conn) : conn
end
should_proxy?(conn) click to toggle source
# File lib/spinel/connection_pool_proxy.rb, line 16
def self.should_proxy?(conn)
  defined?(::ConnectionPool) && conn.is_a?(::ConnectionPool)
end

Public Instance Methods

method_missing(name, *args, &block) click to toggle source
# File lib/spinel/connection_pool_proxy.rb, line 8
def method_missing name, *args, &block
  @pool.with { |x| x.send(name, *args, &block) }
end
respond_to_missing?(name, include_all = false) click to toggle source
# File lib/spinel/connection_pool_proxy.rb, line 12
def respond_to_missing? name, include_all = false
  @pool.with { |x| x.respond_to?(name, include_all) }
end