summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/string.c b/string.c
index b9399c2fd1b..01f3f03d15c 100644
--- a/string.c
+++ b/string.c
@@ -2754,6 +2754,18 @@ rb_str_center(str, w)
}
void
+rb_str_setter(val, id, var)
+ VALUE val;
+ ID id;
+ VALUE *var;
+{
+ if (!NIL_P(val) && TYPE(val) != T_STRING) {
+ rb_raise(rb_eTypeError, "value of %s must be String", rb_id2name(id));
+ }
+ *var = val;
+}
+
+void
Init_String()
{
rb_cString = rb_define_class("String", rb_cObject);