Project

General

Profile

Actions

Bug #1632

closed

ARGF's Iterators Return nill Instead of self

Bug #1632: ARGF's Iterators Return nill Instead of self

Added by runpaint (Run Paint Run Run) over 16 years ago. Updated over 14 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-06-14 trunk 23689) [i686-linux]
Backport:
[ruby-core:23852]

Description

=begin
ARGF#each_char, ARGF#each_byte, ARGF#bytes, and ARGF#chars now return nil when passed a block. On 1.8 they returned self. self is preferable because:

  • The documentation for IO#each_char and IO#each_byte promises that self will be returned.

  • It allows method chaining.

  • It's backward compatiable.

    $ cd /tmp
    $ echo 'a' > file
    $ ruby -ve 'p ARGF.chars {}' file
    ruby 1.9.2dev (2009-06-14 trunk 23689) [i686-linux]
    nil
    $ ruby1.8 -ve 'p ARGF.chars {}' file
    ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
    ARGF
    $ ruby86 -ve 'p ARGF.each_byte {}' file
    ruby 1.8.6 (2009-03-31 patchlevel 368) [i686-linux]
    ARGF
    =end

Actions

Also available in: PDF Atom