ext/-test-/load/protect/protect.c
raw| 1 | #include <ruby.h> |
| 2 | |
| 3 | static VALUE |
| 4 | load_protect(int argc, VALUE *argv, VALUE self) |
| 5 | { |
| 6 | int state; |
| 7 | VALUE path, wrap; |
| 8 | rb_scan_args(argc, argv, "11", &path, &wrap); |
| 9 | rb_load_protect(path, RTEST(wrap), &state); |
| 10 | if (state) rb_jump_tag(state); |
| 11 | return Qnil; |
| 12 | } |
| 13 | |
| 14 | void |
| 15 | Init_protect(void) |
| 16 | { |
| 17 | VALUE mod = rb_define_module("Bug"); |
| 18 | rb_define_singleton_method(mod, "load_protect", load_protect, -1); |
| 19 | } |