I've written a simple Ruby C extension. A method expects the second parameter to be a string-ish VALUE.
VALUE method_foo(VALUE self, VALUE key) {
puts(RSTRING(key)->ptr);
return key;
}
Its very easy to cause a segmentation fault by passing an integer rather than a string. How should I detect this and either prevent or recover in the C method?