class YARP::LibRubyParser::YPBuffer

so it doesn’t need to know the fields of yp_buffer_t.
This object represents a yp_buffer_t. We only use it as an opaque pointer,

def self.with(&block)

automatically freed when the block returns.
Initialize a new buffer and yield it to the block. The buffer will be
def self.with(&block)
  pointer = FFI::MemoryPointer.new(SIZEOF)
  begin
    raise unless LibRubyParser.yp_buffer_init(pointer)
    yield new(pointer)
  ensure
    LibRubyParser.yp_buffer_free(pointer)
    pointer.free
  end
end

def initialize(pointer)

def initialize(pointer)
  @pointer = pointer
end

def length

def length
  LibRubyParser.yp_buffer_length(pointer)
end

def read

def read
  value.read_string(length)
end

def value

def value
  LibRubyParser.yp_buffer_value(pointer)
end