Sha256: a3f94f6e6dd384fcdef5aa8c57315e84f4a3b70281a89e9715204d4e49fc2c6e

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

module Cborb::Decoding::Types
  # To represent major type: 4(indefinite-length)
  #
  # @see https://tools.ietf.org/html/rfc7049#section-2.2.1
  class IndefiniteArray < Type
    def self.indefinite?
      true
    end

    def self.decode(state, additional_info)
      state.push_stack(self, [])
    end

    def self.accept(im_data, type, value)
      if type == Cborb::Decoding::Types::Break
        im_data
      else
        im_data << value
        Cborb::Decoding::State::CONTINUE
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cborb-0.3.0 lib/cborb/decoding/types/indefinite_array.rb
cborb-0.2.0 lib/cborb/decoding/types/indefinite_array.rb
cborb-0.1.0 lib/cborb/decoding/types/indefinite_array.rb