Module: Aws::Cbor Private

Defined in:
lib/aws-sdk-core/cbor.rb,
lib/aws-sdk-core/cbor/decoder.rb,
lib/aws-sdk-core/cbor/encoder.rb,
lib/aws-sdk-core/cbor/cbor_engine.rb

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

Defined Under Namespace

Modules: CborEngine Classes: Decoder, Encoder, Error, ExtraBytesError, OutOfBytesError, Tagged, UnexpectedAdditionalInformationError, UnexpectedBreakCodeError, UnknownTypeError

Class Method Summary collapse

Class Method Details

.decode(bytes) ⇒ Object

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.



74
75
76
77
# File 'lib/aws-sdk-core/cbor.rb', line 74

def decode(bytes)
  bytes.force_encoding(Encoding::BINARY)
  @engine.decode(bytes)
end

.encode(data) ⇒ Object

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.



70
71
72
# File 'lib/aws-sdk-core/cbor.rb', line 70

def encode(data)
  @engine.encode(data)
end

.engineClass

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 the default engine. One of:

Returns:

  • (Class)

    Returns the default engine. One of:



65
66
67
68
# File 'lib/aws-sdk-core/cbor.rb', line 65

def engine
  set_default_engine unless @engine
  @engine
end

.engine=(engine) ⇒ Object

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.

Parameters:

  • engine (Symbol, Class)

    Must be one of the following values:

    • :cbor



56
57
58
# File 'lib/aws-sdk-core/cbor.rb', line 56

def engine=(engine)
  @engine = Class === engine ? engine : load_engine(engine)
end

.set_default_engineObject

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.



79
80
81
82
83
84
85
86
87
# File 'lib/aws-sdk-core/cbor.rb', line 79

def set_default_engine
  [:cbor].each do |name|
    @engine ||= try_load_engine(name)
  end

  unless @engine
    raise 'Unable to find a compatible cbor library.'
  end
end