I am trying to find a way to test symbol equality in the Ruby C API. Consider the following C function:
static VALUE test_symbol_equality(VALUE self, VALUE symbol) {
if (rb_intern("test") == symbol) {
return Qtrue;
} else {
return Qfalse;
}
}
From the Ruby point of view, this method does not behave as expected:
test_symbol_equality(:test) # => false
Why is this the case? How do I need to change the code to achieve the expected behaviour?