Sha256: be79ea04ee8189d80920cdb3cf33f0beadaa23adf0f92139f0435fad91c3609b
Contents?: true
Size: 824 Bytes
Versions: 6
Compression:
Stored size: 824 Bytes
Contents
class Redis module Objects class ConnectionPoolProxy def initialize(pool) raise ArgumentError "Should only proxy ConnectionPool!" unless self.class.should_proxy?(pool) @pool = pool end def method_missing(name, *args, &block) @pool.with { |x| x.send(name, *args, &block) } end ruby2_keywords :method_missing if respond_to?(:ruby2_keywords, true) def respond_to_missing?(name, include_all = false) @pool.with { |x| x.respond_to?(name, include_all) } end def self.should_proxy?(conn) defined?(::ConnectionPool) && conn.is_a?(::ConnectionPool) end def self.proxy_if_needed(conn) if should_proxy?(conn) ConnectionPoolProxy.new(conn) else conn end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems