class YARP::LibRubyParser::YPBuffer
This object represents a yp_buffer_t. We only use it as an opaque pointer, so it doesn’t need to know the fields of yp_buffer_t.
Constants
- SIZEOF
Attributes
pointer[R]
Public Class Methods
new(pointer)
click to toggle source
# File yarp/ffi.rb, line 102 def initialize(pointer) @pointer = pointer end
with() { |new(pointer)| ... }
click to toggle source
Initialize a new buffer and yield it to the block. The buffer will be automatically freed when the block returns.
# File yarp/ffi.rb, line 120 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
Public Instance Methods
length()
click to toggle source
# File yarp/ffi.rb, line 110 def length LibRubyParser.yp_buffer_length(pointer) end
read()
click to toggle source
# File yarp/ffi.rb, line 114 def read value.read_string(length) end
value()
click to toggle source
# File yarp/ffi.rb, line 106 def value LibRubyParser.yp_buffer_value(pointer) end