class Redis::Pipeline::Multi

def commands

def commands
  [[:multi]] + super + [[:exec]]
end

def finish(replies)

def finish(replies)
  return if replies.last.nil? # The transaction failed because of WATCH.
  if replies.last.size < futures.size - 2
    # Some command wasn't recognized by Redis.
    raise replies.detect { |r| r.kind_of?(::RuntimeError) }
  end
  super(replies.last) do |reply|
    # Because an EXEC returns nested replies, hiredis won't be able to
    # convert an error reply to a CommandError instance itself. This is
    # specific to MULTI/EXEC, so we solve this here.
    reply.is_a?(::RuntimeError) ? CommandError.new(reply.message) : reply
  end
end