ext/-test-/exception/enc_raise.c
raw| 1 | #include <ruby.h> |
| 2 | #include <ruby/encoding.h> |
| 3 | |
| 4 | static VALUE |
| 5 | enc_raise(VALUE exc, VALUE encoding, VALUE mesg) |
| 6 | { |
| 7 | rb_enc_raise(rb_to_encoding(encoding), exc, "%s", StringValueCStr(mesg)); |
| 8 | UNREACHABLE_RETURN(Qnil); |
| 9 | } |
| 10 | |
| 11 | void |
| 12 | Init_enc_raise(VALUE klass) |
| 13 | { |
| 14 | rb_define_module_function(klass, "enc_raise", enc_raise, 2); |
| 15 | } |