Skip to content

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

class method

IO.open

IO.open(fd, mode = 'r', **opts) → io
IO.open(fd, mode = 'r', **opts) {|io| ... } → object

Creates a new IO object, via IO.new with the given arguments.

With no block given, returns the IO object.

With a block given, calls the block with the IO object and returns the block’s value.

See also .new .pipe .for_fd .popen also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0