Method: Racket::Misc::VT#decode
- Defined in:
- lib/racket/misc/vt.rb
#decode(data) ⇒ Object
Given data, return the value and an array of the types as dictated by this instance
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/racket/misc/vt.rb', line 52 def decode(data) null = data.index(0x00) value = data.unpack("a#{null}")[0] data = data.slice(null+1, data.length) n = 0 types = [] @lengths.each do |l| types[n] = data.unpack("#{punpack_string(l)}")[0] data = data.slice(l, data.length) n += 1 end [value, types, data] end |