Issue #7654 has been updated by shock_one (??олодими?? Ша????кий).


Thank you, Eregon, especially for in place methods. I should definitely pay more attention to them - functional languages made me a little suspicious of this sort of things.
But I still think it would be nice to have an optional block in IO::readlines, at least for convenience. Enumerable#grep has similar behavior and I find it really cool and useful. Also this change doesn't break anything, is easy to implement and makes the code more concise.
----------------------------------------
Feature #7654: Add optional code block to IO::readlines
https://bugs.ruby-lang.org/issues/7654#change-35213

Author: shock_one (??олодими?? Ша????кий)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 


Of course, we always can write something like
File.readlines('/home/shock_one/test.rb').map{ |line| line.upcase }
but this way we create unneeded intermediate array which can be pretty big.
There is also a method IO::foreach, but it doesn't collect return values.
Besides it seems pretty logical and natural to have a block in this method.


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