class Cborb::Decoding::SimpleBuffer

Public Class Methods

new() click to toggle source
# File lib/cborb/decoding/simple_buffer.rb, line 7
def initialize
  @buffer = StringIO.new
  @buffer.set_encoding(Encoding::ASCII_8BIT)
end

Public Instance Methods

peek() click to toggle source
# File lib/cborb/decoding/simple_buffer.rb, line 24
def peek
  pos = @buffer.pos
  @buffer.read.to_s.tap { @buffer.pos = pos }
end
reset!() click to toggle source
# File lib/cborb/decoding/simple_buffer.rb, line 19
def reset!
  @buffer.rewind
  @buffer.truncate(0)
end
write(data) click to toggle source

@param [String] data

# File lib/cborb/decoding/simple_buffer.rb, line 13
def write(data)
  pos = @buffer.pos
  @buffer << data
  @buffer.pos = pos
end