Sha256: c3222a89b82d2ffadd8ea089faccb2470b016e3f0b2b6c06c697b0d901d1c23a
Contents?: true
Size: 669 Bytes
Versions: 13
Compression:
Stored size: 669 Bytes
Contents
#include <xml_io.h> static ID id_read, id_write; int io_read_callback(void * ctx, char * buffer, int len) { VALUE io = (VALUE)ctx; VALUE string = rb_funcall(io, id_read, 1, INT2NUM(len)); if(NIL_P(string)) return 0; memcpy(buffer, StringValuePtr(string), (size_t)RSTRING_LEN(string)); return (int)RSTRING_LEN(string); } int io_write_callback(void * ctx, char * buffer, int len) { VALUE io = (VALUE)ctx; VALUE string = rb_str_new(buffer, (long)len); rb_funcall(io, id_write, 1, string); return len; } int io_close_callback(void * ctx) { return 0; } void init_nokogiri_io() { id_read = rb_intern("read"); id_write = rb_intern("write"); }
Version data entries
13 entries across 13 versions & 3 rubygems