Method: CTypes::Type#unpack_all

Defined in:
lib/ctypes/type.rb

#unpack_all(buf, endian: default_endian) ⇒ Object

unpack as many instances of Type are present in the supplied string

Parameters:

  • buf (String)

    bytes that make up the type

  • endian (Symbol) (defaults to: default_endian)

    endian of data within buf



77
78
79
80
81
82
83
84
# File 'lib/ctypes/type.rb', line 77

def unpack_all(buf, endian: default_endian)
  out = []
  until buf.empty?
    t, buf = unpack_one(buf, endian:)
    out << t
  end
  out
end