Sha256: 9c27d8190f8edd8a330cb8c95f0781f6faf97bda90fe4e82573db3251aa35e77

Contents?: true

Size: 433 Bytes

Versions: 1

Compression:

Stored size: 433 Bytes

Contents

module Cborb::Decoding
  class SimpleBuffer
    extend Forwardable

    def_delegators :@buffer, :read, :getbyte, :eof?

    def initialize
      @buffer = StringIO.new
      @buffer.set_encoding(Encoding::ASCII_8BIT)
    end

    # @param [String] data
    def write(data)
      pos = @buffer.pos
      @buffer << data
      @buffer.pos = pos
    end

    def reset!
      @buffer.rewind
      @buffer.truncate(0)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cborb-0.1.0 lib/cborb/decoding/simple_buffer.rb