summaryrefslogtreecommitdiff
path: root/ext/-test-/marshal/internal_ivar/internal_ivar.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/-test-/marshal/internal_ivar/internal_ivar.c')
-rw-r--r--ext/-test-/marshal/internal_ivar/internal_ivar.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ext/-test-/marshal/internal_ivar/internal_ivar.c b/ext/-test-/marshal/internal_ivar/internal_ivar.c
index 299da27f23d..de0cf711aa3 100644
--- a/ext/-test-/marshal/internal_ivar/internal_ivar.c
+++ b/ext/-test-/marshal/internal_ivar/internal_ivar.c
@@ -1,12 +1,13 @@
#include <ruby.h>
-static ID id_normal_ivar, id_internal_ivar;
+static ID id_normal_ivar, id_internal_ivar, id_encoding_short;
static VALUE
-init(VALUE self, VALUE arg1, VALUE arg2)
+init(VALUE self, VALUE arg1, VALUE arg2, VALUE arg3)
{
rb_ivar_set(self, id_normal_ivar, arg1);
rb_ivar_set(self, id_internal_ivar, arg2);
+ rb_ivar_set(self, id_encoding_short, arg3);
return self;
}
@@ -22,6 +23,12 @@ get_internal(VALUE self)
return rb_attr_get(self, id_internal_ivar);
}
+static VALUE
+get_encoding_short(VALUE self)
+{
+ return rb_attr_get(self, id_encoding_short);
+}
+
void
Init_internal_ivar(void)
{
@@ -33,7 +40,9 @@ Init_internal_ivar(void)
/* leave id_internal_ivar being 0 */
id_internal_ivar = rb_make_internal_id();
#endif
- rb_define_method(newclass, "initialize", init, 2);
+ id_encoding_short = rb_intern_const("E");
+ rb_define_method(newclass, "initialize", init, 3);
rb_define_method(newclass, "normal", get_normal, 0);
rb_define_method(newclass, "internal", get_internal, 0);
+ rb_define_method(newclass, "encoding_short", get_encoding_short, 0);
}