Project

General

Profile

Actions

Feature #7654

open

Add optional code block to IO::readlines

Added by shock_one (Володимир Шацький) almost 12 years ago. Updated 8 months ago.

Status:
Assigned
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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0