Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

ARGF#to_io

ARGF.to_io → IO

Returns an IO object representing the current file. This will be a File object unless the current file is a stream such as STDIN.

For example:

Example
ARGF.to_io    #=> #<File:glark.txt>
ARGF.to_io    #=> #<IO:<STDIN>>
See also #to_i #to_s #to_a #to_write_io also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0