class Bytepack::AnyType

Private Class Methods

pack(val) click to toggle source
# File lib/bytepack/any_type.rb, line 5
def pack(val)
  dataType = packingDataType(val)
  TypeInfo.pack(dataType) + dataType.pack(val)
end
unpack(bytes, offset = 0) click to toggle source
# File lib/bytepack/any_type.rb, line 10
def unpack(bytes, offset = 0)
  dataType, offset = *TypeInfo.unpack(bytes, offset)
  if dataType.nil?
    [nil, offset]
  else
    dataType.unpack(bytes, offset)
  end
end