Skip to content

ARGF: per-unit iterators, byte reads, file, and true method aliases - #481

Merged
tannevaled merged 1 commit into
mainfrom
feat/argf-iterators
Aug 29, 2026
Merged

tannevaled merged 1 commit into
mainfrom
feat/argf-iterators

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Extends ARGF with the character/byte iteration protocol and tidies its aliases:

  • each_byte / each_char / each_codepoint yield every unit across the
    files (an Enumerator with no block), and getbyte / readbyte read a
    single byte.
  • file returns the IO of the file currently being read.
  • eof, path, to_a and each are now true aliases of eof?, filename,
    readlines and each_line (sharing the method record), so MRI's
    Method-equality specs pass.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
ratchet floor rises 16150 → 16170 (core/argf 42 → 61, zero regressions in a
per-file sweep). fileno/to_i, seek/pos/rewind and set_encoding still
await the fd layer.

🤖 Generated with Claude Code

Extend ARGF with the character/byte iteration protocol and tidy its aliases:

- each_byte / each_char / each_codepoint yield every unit across the files (an
  Enumerator with no block), and getbyte / readbyte read a single byte.
- file returns the IO of the file currently being read.
- eof, path, to_a and each are now true aliases of eof?, filename, readlines and
  each_line (sharing the method record), so MRI's Method-equality specs pass.

Verified against ruby 4.0.6. Whole-package coverage stays at 100%; the ruby/spec
floor rises 16150 -> 16170 (core/argf 42 -> 61). fileno/to_i, seek/pos/rewind and
set_encoding still await the fd layer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit 30fe649 into main Aug 29, 2026
7 checks passed
@tannevaled
tannevaled deleted the feat/argf-iterators branch August 29, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant