class YARP::LibRubyParser::YPString

so it doesn’t have to be an FFI::Struct.
This object represents a yp_string_t. We only use it as an opaque pointer,

def self.with(filepath, &block)

Yields a yp_string_t pointer to the given block.
def self.with(filepath, &block)
  pointer = FFI::MemoryPointer.new(SIZEOF)
  begin
    raise unless LibRubyParser.yp_string_mapped_init(pointer, filepath)
    yield new(pointer)
  ensure
    LibRubyParser.yp_string_free(pointer)
    pointer.free
  end
end

def initialize(pointer)

def initialize(pointer)
  @pointer = pointer
end

def length

def length
  LibRubyParser.yp_string_length(pointer)
end

def read

def read
  source.read_string(length)
end

def source

def source
  LibRubyParser.yp_string_source(pointer)
end