Sha256: b3e6a9ef9e28cdc934ad7c2f494747b62d7570c2f259a25f50da651e83d9929a
Contents?: true
Size: 745 Bytes
Versions: 10
Compression:
Stored size: 745 Bytes
Contents
class Redis module Connection module CommandHelper COMMAND_DELIMITER = "\r\n" def build_command(args) command = [nil] args.each do |i| if i.is_a? Array i.each do |j| j = j.to_s command << "$#{j.bytesize}" command << j end else i = i.to_s command << "$#{i.bytesize}" command << i end end command[0] = "*#{(command.length - 1) / 2}" # Trailing delimiter command << "" command.join(COMMAND_DELIMITER) end protected def encode(string) string.force_encoding(Encoding.default_external) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems