summaryrefslogtreecommitdiff
path: root/ext/-test-/struct/member.c
blob: f5400fe477ba638e23719ff8c079d45d84d9648a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "ruby.h"

static VALUE
bug_struct_get(VALUE obj, VALUE name)
{
    ID id = rb_check_id(&name);

    if (!id) {
        rb_name_error_str(name, "`%"PRIsVALUE"' is not a struct member", name);
    }
    return rb_struct_getmember(obj, id);
}

void
Init_member(VALUE klass)
{
    rb_define_method(klass, "get", bug_struct_get, 1);
}