Sha256: 800bcca0427e2adaf845e9e127beb3d8a08b57b25e60a959d75087d3ec7d4088
Contents?: true
Size: 875 Bytes
Versions: 2
Compression:
Stored size: 875 Bytes
Contents
class Redis2 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 if defined?(Encoding::default_external) def encode(string) string.force_encoding(Encoding::default_external) end else def encode(string) string end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
redis2-namespaced-3.0.7.1 | lib/redis2/connection/command_helper.rb |
redis2-namespaced-3.0.7 | lib/redis2/connection/command_helper.rb |