Project

General

Profile

Bug #1487

String#each_char must return self

Added by marcandre (Marc-Andre Lafortune) over 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
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

Also available in: Atom PDF