Sha256: 7731b7d40c76ed61d748b1030d09ea570774de25fea44d7805d8b210616cac9a

Contents?: true

Size: 588 Bytes

Versions: 4

Compression:

Stored size: 588 Bytes

Contents

module FakeRedis
  module CommandExecutor
    def write(command)
      meffod = command[0].to_s.downcase.to_sym
      args = command[1..-1]

      if in_multi && !(TRANSACTION_COMMANDS.include? meffod) # queue commands
        queued_commands << [meffod, *args]
        reply = 'QUEUED'
      elsif respond_to?(meffod) && method(meffod).arity.zero?
        reply = send(meffod)
      elsif respond_to?(meffod)
        reply = send(meffod, *args)
      else
        raise Redis::CommandError, "ERR unknown command '#{meffod}'"
      end

      replies << reply
      nil
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fakeredis-0.9.2 lib/fakeredis/command_executor.rb
fakeredis-0.9.1 lib/fakeredis/command_executor.rb
fakeredis-0.9.0 lib/fakeredis/command_executor.rb
fakeredis-0.8.0 lib/fakeredis/command_executor.rb