Project

General

Profile

Feature #7654

Add optional code block to IO::readlines

Added by shock_one (Володимир Шацький) over 7 years ago. Updated over 2 years ago.

Status:
Open
Priority:
Normal
Target version:
-
[ruby-core:51240]

Description

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.

Also available in: Atom PDF