1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/-test-/struct/member.c

19 lines
332 B
C
Raw Normal View History

#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);
}