class Cborb::Decoding::Types::Array

To represent major type: 4(definite-length)

@see tools.ietf.org/html/rfc7049#section-2.1

Constants

Intermediate

Public Class Methods

accept(im_data, type, value) click to toggle source
# File lib/cborb/decoding/types/array.rb, line 20
def self.accept(im_data, type, value)
  im_data.array << value
  im_data.size == im_data.array.size ? im_data.array : Cborb::Decoding::State::CONTINUE
end
decode(state, additional_info) click to toggle source
# File lib/cborb/decoding/types/array.rb, line 10
def self.decode(state, additional_info)
  size = consume_as_integer(state, additional_info)

  if size > 0
    state.push_stack(self, Intermediate.new(size, []))
  else
    state.accept_value(self, [])
  end
end