mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
1fadd43881
* marshal.c (w_objivar): skip internal instance variables in T_OBJECT too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
39 lines
929 B
C
39 lines
929 B
C
#include <ruby.h>
|
|
|
|
static ID id_normal_ivar, id_internal_ivar;
|
|
|
|
static VALUE
|
|
init(VALUE self, VALUE arg1, VALUE arg2)
|
|
{
|
|
rb_ivar_set(self, id_normal_ivar, arg1);
|
|
rb_ivar_set(self, id_internal_ivar, arg2);
|
|
return self;
|
|
}
|
|
|
|
static VALUE
|
|
get_normal(VALUE self)
|
|
{
|
|
return rb_attr_get(self, id_normal_ivar);
|
|
}
|
|
|
|
static VALUE
|
|
get_internal(VALUE self)
|
|
{
|
|
return rb_attr_get(self, id_internal_ivar);
|
|
}
|
|
|
|
void
|
|
Init_internal_ivar(void)
|
|
{
|
|
VALUE mMarshal = rb_define_module_under(rb_define_module("Bug"), "Marshal");
|
|
VALUE newclass = rb_define_class_under(mMarshal, "InternalIVar", rb_cObject);
|
|
|
|
id_normal_ivar = rb_intern_const("normal");
|
|
#if 0
|
|
/* leave id_internal_ivar being 0 */
|
|
id_internal_ivar = rb_make_internal_id();
|
|
#endif
|
|
rb_define_method(newclass, "initialize", init, 2);
|
|
rb_define_method(newclass, "normal", get_normal, 0);
|
|
rb_define_method(newclass, "internal", get_internal, 0);
|
|
}
|