class Aws::Cbor::Decoder

def decode_item

the next item as a ruby object.
high level, generic decode. Based on the next type. Consumes and returns
def decode_item
  case (next_type = peek_type)
  when :array
    read_array.times.map { decode_item }
  when :map
    read_map.times.map { [read_string, decode_item] }.to_h
  when :indefinite_array
    read_start_indefinite_array
    value = []
    value << decode_item until peek_type == :break_stop_code
    read_end_indefinite_collection
    value
  when :indefinite_map
    read_start_indefinite_map
    value = {}
    value[read_string] = decode_item until peek_type == :break_stop_code
    read_end_indefinite_collection
    value
  when :indefinite_binary_string
    read_info
    value = String.new
    value << read_binary_string until peek_type == :break_stop_code
    read_end_indefinite_collection
    value
  when :indefinite_string
    read_info
    value = String.new
    value << read_string until peek_type == :break_stop_code
    read_end_indefinite_collection
    value.force_encoding(Encoding::UTF_8)
  when :tag
    case (tag = read_tag)
    when TAG_TYPE_EPOCH
      type = peek_type
      item = decode_item
      item /= 1000.0 if type == :integer
      Time.at(item)
    when TAG_TYPE_BIGNUM, TAG_TYPE_NEG_BIGNUM
      read_bignum(tag)
    when TAG_TYPE_BIGDEC
      read_big_decimal
    else
      Tagged.new(tag, decode_item)
    end
  when :break_stop_code
    raise UnexpectedBreakCodeError
  else
    send("read_#{next_type}")
  end
end