Class: Aws::Cbor::Decoder Private

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-sdk-core/cbor/decoder.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Pure Ruby implementation of CBOR Decoder

API:

  • private

Instance Method Summary collapse

Constructor Details

#initialize(bytes) ⇒ Decoder

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Decoder.

API:

  • private



7
8
9
10
# File 'lib/aws-sdk-core/cbor/decoder.rb', line 7

def initialize(bytes)
  @buffer = bytes
  @pos = 0
end

Instance Method Details

#decodeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:

API:

  • private



12
13
14
15
16
17
18
19
# File 'lib/aws-sdk-core/cbor/decoder.rb', line 12

def decode
  return nil if @buffer.nil? || @buffer.empty?

  val = decode_item
  return val unless @pos != @buffer.size

  raise ExtraBytesError.new(@pos, @buffer.size)
end