ext/-test-/struct/member.c
raw| 1 | #include "ruby.h" |
| 2 | |
| 3 | static VALUE |
| 4 | bug_struct_get(VALUE obj, VALUE name) |
| 5 | { |
| 6 | ID id = rb_check_id(&name); |
| 7 | |
| 8 | if (!id) { |
| 9 | rb_name_error_str(name, "`%"PRIsVALUE"' is not a struct member", name); |
| 10 | } |
| 11 | return rb_struct_getmember(obj, id); |
| 12 | } |
| 13 | |
| 14 | void |
| 15 | Init_member(VALUE klass) |
| 16 | { |
| 17 | rb_define_method(klass, "get", bug_struct_get, 1); |
| 18 | } |