Sha256: 148cf93f893115c2bc1c71db110bc7c2b289c49031b1955a9b40bbedc0e61edd

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

module FakeRedis
  module CommandExecutor
    def write(command)
      meffod = command.shift.to_s.downcase.to_sym

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

      if reply == true
        reply = 1
      elsif reply == false
        reply = 0
      end

      replies << reply
      nil
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
fakeredis-0.6.0 lib/fakeredis/command_executor.rb
kuende-fakeredis-0.6.0 lib/fakeredis/command_executor.rb
fakeredis-0.5.0 lib/fakeredis/command_executor.rb