class Redis::SubscribedClient

def psubscribe(*channels, &block)

def psubscribe(*channels, &block)
  @client.call_async(:psubscribe, *channels)
  sub = Subscription.new(&block)
  begin
    loop do
      type, pattern, channel, message = @client.read
      sub.callbacks[type].call(pattern, channel, message)
      break if type == "punsubscribe" && channel == 0
    end
  ensure
    @client.call_async(:punsubscribe)
  end
end