Skip to content

Instantly share code, notes, and snippets.

@patrickt
Created April 5, 2009 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickt/90361 to your computer and use it in GitHub Desktop.
Save patrickt/90361 to your computer and use it in GitHub Desktop.
rb_io_s_open(VALUE klass, SEL sel, int argc, VALUE *argv)
{
printf("Beginning the opening lol.");
VALUE io = rb_io_s_new(klass, sel, argc, argv);
if (rb_block_given_p()) {
VALUE ret = rb_vm_yield(1, &io);
rb_io_close_m(io, 0);
return ret;
}
return io;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment