Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 27 lines (20 sloc) 0.561 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#include "capi/capi.hpp"
#include "capi/18/include/ruby.h"

using namespace rubinius;
using namespace rubinius::capi;

extern "C" {
  VALUE rb_marshal_dump(VALUE obj, VALUE io) {
    int argc = 1;
    VALUE argv[2];
    VALUE marshal = rb_const_get(rb_cObject, rb_intern("Marshal"));

    argv[0] = obj;

    if (!NIL_P(io)) {
      argv[1] = io;
      argc = 2;
    }

    return rb_funcall2(marshal, rb_intern("dump"), argc, argv);
  }

  VALUE rb_marshal_load(VALUE data) {
    return rb_funcall(rb_path2class("Marshal"), rb_intern("load"), 1, data);
  }

}
Something went wrong with that request. Please try again.