Sha256: 50f476a04603d5c648dab484acb63f395f1b23605b7fac632e4caf6b05a3d737

Contents?: true

Size: 1014 Bytes

Versions: 25

Compression:

Stored size: 1014 Bytes

Contents

#include "polyphony.h"

VALUE Socket_send(VALUE self, VALUE msg, VALUE flags) {
  return Backend_send(BACKEND(), self, msg, flags);
}

VALUE Socket_write(int argc, VALUE *argv, VALUE self) {
  VALUE ary = rb_ary_new_from_values(argc, argv);
  VALUE result = Backend_sendv(BACKEND(), self, ary, INT2NUM(0));
  RB_GC_GUARD(ary);
  return result;
}

VALUE Socket_double_chevron(VALUE self, VALUE msg) {
  Backend_send(BACKEND(), self, msg, INT2NUM(0));
  return self;
}

void Init_SocketExtensions() {
  rb_require("socket");

  VALUE cSocket = rb_const_get(rb_cObject, rb_intern("Socket"));
  VALUE cTCPSocket = rb_const_get(rb_cObject, rb_intern("TCPSocket"));

  rb_define_method(cSocket, "send", Socket_send, 2);
  rb_define_method(cTCPSocket, "send", Socket_send, 2);

  rb_define_method(cSocket, "write", Socket_write, -1);
  rb_define_method(cTCPSocket, "write", Socket_write, -1);

  rb_define_method(cSocket, "<<", Socket_double_chevron, 1);
  rb_define_method(cTCPSocket, "<<", Socket_double_chevron, 1);
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
polyphony-0.73.1 ext/polyphony/socket_extensions.c
polyphony-0.73 ext/polyphony/socket_extensions.c
polyphony-0.72 ext/polyphony/socket_extensions.c
polyphony-0.71 ext/polyphony/socket_extensions.c
polyphony-0.70 ext/polyphony/socket_extensions.c
polyphony-0.69 ext/polyphony/socket_extensions.c
polyphony-0.68 ext/polyphony/socket_extensions.c
polyphony-0.67 ext/polyphony/socket_extensions.c
polyphony-0.66 ext/polyphony/socket_extensions.c
polyphony-0.65 ext/polyphony/socket_extensions.c
polyphony-0.64 ext/polyphony/socket_extensions.c
polyphony-0.63 ext/polyphony/socket_extensions.c
polyphony-0.62 ext/polyphony/socket_extensions.c
polyphony-0.61 ext/polyphony/socket_extensions.c
polyphony-0.60 ext/polyphony/socket_extensions.c
polyphony-0.59.1 ext/polyphony/socket_extensions.c
polyphony-0.59 ext/polyphony/socket_extensions.c
polyphony-0.58 ext/polyphony/socket_extensions.c
polyphony-0.57.0 ext/polyphony/socket_extensions.c
polyphony-0.56.0 ext/polyphony/socket_extensions.c