From: "headius (Charles Nutter)" Date: 2012-11-27T01:49:06+09:00 Subject: [ruby-core:50171] [ruby-trunk - Bug #7440] IO#lines etc. should return Array Issue #7440 has been updated by headius (Charles Nutter). Is this really wnat you'd want? ARGF and IO (and possibly Zlib's readers) can stream data lazily in lines/chars/bytes/codepoints, where forcing them to an Array would have to eagerly read everything (and potentially block). irb(main):001:0> io = File.open('Makefile') => # irb(main):002:0> lines = io.lines => #:lines> irb(main):003:0> lines.next => "SHELL = /bin/sh\n" irb(main):004:0> io.pos => 16 irb(main):005:0> lines.next => "NULLCMD = :\n" irb(main):006:0> io.pos => 28 irb(main):007:0> lines.to_a; nil => nil irb(main):008:0> io.pos => 12737 ---------------------------------------- Bug #7440: IO#lines etc. should return Array https://bugs.ruby-lang.org/issues/7440#change-33970 Author: yhara (Yutaka HARA) Status: Open Priority: Normal Assignee: yhara (Yutaka HARA) Category: core Target version: 2.0.0 ruby -v: ruby 2.0.0dev (2012-11-26 trunk 36708) [x86_64-darwin12.2.1] String#bytes, #chars, #codepints and #lines are changed to return Array in #6670. For consistent behavior, following methods should return Array too: * ARGF.lines, chars, bytes, codepoints * IO#lines, chars, bytes, codepoints * StringIO#lines, chars, bytes, codepoints * Zlib::GzipReader#lines, bytes Please let me know if there are more. -- http://bugs.ruby-lang.org/