class CBOR::Unpacker

Public Class Methods

new(match_array, prefix_array, suffix_array) click to toggle source
# File lib/cbor-packed.rb, line 132
def initialize(match_array, prefix_array, suffix_array)
  @simple_array = match_array[0...16]
  @tagged_array = match_array[16..-1]
  # index with 2i for i >= 0 or ~2i for i < 0
  # no map as we need to populate in progress
  # pp prefix_array
  @prefix_array = []
  prefix_array.each {|x| @prefix_array << x.to_unpacked_cbor1(self)}
  @suffix_array = []
  suffix_array.each {|x| @prefix_array << x.to_unpacked_cbor1(self)}
  # XXX order? -- must do lazily!
end

Public Instance Methods

unprefix(n) click to toggle source
# File lib/cbor-packed.rb, line 150
def unprefix(n)
  @prefix_array[n]
end
unsimple(sv) click to toggle source
# File lib/cbor-packed.rb, line 144
def unsimple(sv)
  @simple_array[sv]
end
unsuffix(n) click to toggle source
# File lib/cbor-packed.rb, line 153
def unsuffix(n)
  @suffix_array[n]
end
untag(tv) click to toggle source
# File lib/cbor-packed.rb, line 147
def untag(tv)
  @tagged_array[(i << 1) ^ (i >> 63)]
end