lib/garcon/stash/format.rb
# Serialize record and return string.
#
# @param [Array] rec
#   an array with [key, value] or [key] if the record is deleted
#
# @return [String] serialized record
#
Serialize record and return string.
Serialize record and return string .
def dump(rec)
        data = if rec.size == 1
          [rec[0].bytesize, DELETE].pack('NN') << rec[0]
        else
          [rec[0].bytesize, rec[1].bytesize].pack('NN') << rec[0] << rec[1]
        end
        data << crc32(data)
      end
def dump ( rec ) data = if rec . size == 1 [ rec [ 0 ] . bytesize , DELETE ] . pack ( 'NN' ) << rec [ 0 ] else [ rec [ 0 ] . bytesize , rec [ 1 ] . bytesize ] . pack ( 'NN' ) << rec [ 0 ] << rec [ 1 ] end data << crc32 ( data ) end
Serialize record and return string.
Serialize record and return string .
None
String
rec
<not_specific>
<not_specific>
rec an array with [key, value] or [key] if the record is deleted
rec an array with [ key value ] or [ key ] if the record is deleted