summaryrefslogtreecommitdiff
path: root/jni/ruby/ext/-test-/struct/member.c
blob: 1d404039b49d95725ef6877dd524be0630c526e8 (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);
}