class Redis::Objects::ConnectionPoolProxy

Public Class Methods

new(pool) click to toggle source
# File lib/redis/objects/connection_pool_proxy.rb, line 4
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/redis/objects/connection_pool_proxy.rb, line 22
def self.proxy_if_needed(conn)
  if should_proxy?(conn)
    ConnectionPoolProxy.new(conn)
  else
    conn
  end
end
should_proxy?(conn) click to toggle source
# File lib/redis/objects/connection_pool_proxy.rb, line 18
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/redis/objects/connection_pool_proxy.rb, line 9
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/redis/objects/connection_pool_proxy.rb, line 14
def respond_to_missing?(name, include_all = false)
  @pool.with { |x| x.respond_to?(name, include_all) }
end