Sha256: 6215690431277e7e2be6e1f49edd7e673bf809356c5b56cf7fd304928f61d35c
Contents?: true
Size: 529 Bytes
Versions: 2
Compression:
Stored size: 529 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 def peek pos = @buffer.pos @buffer.read.to_s.tap { @buffer.pos = pos } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cborb-0.3.0 | lib/cborb/decoding/simple_buffer.rb |
cborb-0.2.0 | lib/cborb/decoding/simple_buffer.rb |