summaryrefslogtreecommitdiff
path: root/jni/ruby/ext/-test-/class/class2name.c
blob: c48df6fb2aee7d36fd2173d9b6b3807192447976 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <ruby/ruby.h>

static VALUE
class2name(VALUE self, VALUE klass)
{
    const char *name = rb_class2name(klass);
    return name ? rb_str_new_cstr(name) : Qnil;
}

void
Init_class2name(VALUE klass)
{
    rb_define_singleton_method(klass, "class2name", class2name, 1);
}