From: "davishmcclurg (David Harsha) via ruby-core" Date: 2023-05-03T02:17:36+00:00 Subject: [ruby-core:113396] [Ruby master Feature#19628] Add ARGF.each_file for iterating file/io objects Issue #19628 has been reported by davishmcclurg (David Harsha). ---------------------------------------- Feature #19628: Add ARGF.each_file for iterating file/io objects https://bugs.ruby-lang.org/issues/19628 * Author: davishmcclurg (David Harsha) * Status: Open * Priority: Normal ---------------------------------------- `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 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/