Project

General

Profile

Actions

Feature #19628

open

Add ARGF.each_file for iterating file/io objects

Added by davishmcclurg (David Harsha) over 1 year ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:113396]

Description

ARGF provides helpers for processing file/stdin command line arguments in various ways (bytes, chars, codepoints, etc), but it doesn't currently have a simple way to iterate through the arguments as File/IO objects. This can be useful when you want to perform an operation on the contents of an entire file (eg, JSON parsing) instead of combining them into a single string or going line-by-line. My proposal is to add an ARGF.each_file method that yields each file (or returns an enumerator if no block is provided).

Possible implementation: https://github.com/davishmcclurg/ruby/commit/cc8054c2737243f839d72622977a44fe84a95335

No data to display

Actions

Also available in: Atom PDF

Like0