lib/fakeredis/command_executor.rb in fakeredis-0.6.0 vs lib/fakeredis/command_executor.rb in fakeredis-0.7.0
- old
+ new
@@ -1,14 +1,17 @@
module FakeRedis
module CommandExecutor
def write(command)
- meffod = command.shift.to_s.downcase.to_sym
+ meffod = command[0].to_s.downcase.to_sym
+ args = command[1..-1]
if in_multi && !(TRANSACTION_COMMANDS.include? meffod) # queue commands
- queued_commands << [meffod, *command]
+ queued_commands << [meffod, *args]
reply = 'QUEUED'
+ elsif respond_to?(meffod) && method(meffod).arity.zero?
+ reply = send(meffod)
elsif respond_to?(meffod)
- reply = send(meffod, *command)
+ reply = send(meffod, *args)
else
raise Redis::CommandError, "ERR unknown command '#{meffod}'"
end
if reply == true