Project

General

Profile

Actions

Bug #1487

closed

String#each_char must return self

Added by marcandre (Marc-Andre Lafortune) almost 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.2dev (2009-05-19 trunk 23489) [i386-darwin9.7.0]
Backport:
[ruby-core:23499]

Description

=begin
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;
    =end
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0