ruby/ext/stringio
Samuel Williams 18e55fc1e1
Hide most of the implementation of struct rb_io. (#6511)
* Add rb_io_path and rb_io_open_descriptor.

* Use rb_io_open_descriptor to create PTY objects

* Rename FMODE_PREP -> FMODE_EXTERNAL and expose it

FMODE_PREP I believe refers to the concept of a "pre-prepared" file, but
FMODE_EXTERNAL is clearer about what the file descriptor represents and
aligns with language in the IO::Buffer module.

* Ensure that rb_io_open_descriptor closes the FD if it fails

If FMODE_EXTERNAL is not set, then it's guaranteed that Ruby will be
responsible for closing your file, eventually, if you pass it to
rb_io_open_descriptor, even if it raises an exception.

* Rename IS_EXTERNAL_FD -> RUBY_IO_EXTERNAL_P

* Expose `rb_io_closed_p`.

* Add `rb_io_mode` to get IO mode.

---------

Co-authored-by: KJ Tsanaktsidis <ktsanaktsidis@zendesk.com>
2023-05-30 10:02:40 +09:00
..
depend Update the depend files 2023-02-28 09:09:00 -08:00
extconf.rb [ruby/stringio] Drop support for ruby 2.6 or earlier 2023-05-08 07:21:21 +00:00
README.md ext/stringio/README.md: update [ci skip] 2016-06-08 07:47:39 +00:00
stringio.c Hide most of the implementation of struct rb_io. (#6511) 2023-05-30 10:02:40 +09:00
stringio.gemspec [ruby/stringio] Drop support for ruby 2.6 or earlier 2023-05-08 07:21:21 +00:00

StringIO

Pseudo IO class from/to String.

This library is based on MoonWolf version written in Ruby. Thanks a lot.

Differences to IO

  • fileno raises NotImplementedError.
  • encoding conversion is not implemented, and ignored silently.