Bug #1487: String#each_char must return self
http://redmine.ruby-lang.org/issues/show/1487

Author: Marc-Andre Lafortune
Status: Open, Priority: Low
Category: core, Target version: 1.9.2
ruby -v: ruby 1.9.2dev (2009-05-19 trunk 23489) [i386-darwin9.7.0]

str.each_char{} currently returns a copy of str. It should return self. This also affects Ruby 1.8.7

Poor man's diff for rb_str_each_char:

    rb_encoding *enc;
+    VALUE orig = str;
    RETURN_ENUMERATOR(str, 0, 0);
    str = rb_str_new4(str);
...
-    return str;
+    return orig;


----------------------------------------
http://redmine.ruby-lang.org