aboutsummaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/string.c b/string.c
index f388d24db6..efa817ea43 100644
--- a/string.c
+++ b/string.c
@@ -2076,6 +2076,9 @@ str_gsub(argc, argv, str, bang)
blen = RSTRING(str)->len + 30; /* len + margin */
dest = rb_str_new5(str, 0, blen);
+ if (bang) {
+ RBASIC(dest)->klass = 0;
+ }
buf = RSTRING(dest)->ptr;
bp = buf;
sp = cp = RSTRING(str)->ptr;