Parent

Methods

Redis::Pipeline::Multi

Public Instance Methods

commands() click to toggle source
# File lib/redis/pipeline.rb, line 91
def commands
  [[:multi]] + super + [[:exec]]
end
finish(replies) click to toggle source
# File lib/redis/pipeline.rb, line 70
def finish(replies)
  exec = replies.last

  return if exec.nil? # The transaction failed because of WATCH.

  # EXEC command failed.
  raise exec if exec.is_a?(CommandError)

  if exec.size < futures.size - 2
    # Some command wasn't recognized by Redis.
    raise replies.detect { |r| r.is_a?(CommandError) }
  end

  super(exec) 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.