rb_gets

Function rb_gets 

Source
pub unsafe extern "C" fn rb_gets() -> VALUE
Expand description

Much like rb_io_gets, but it reads from the mysterious ARGF object. ARGF in this context can be seen as a virtual IO which concatenates contents of the files passed to the process via the ARGV, or just STDIN if there are no such files.

Unlike rb_io_gets this function sets $_.

@exception rb_eFrozenError ARGF resorts to STDIN but it is frozen. @retval RUBY_Qnil ARGF is at EOF. @retval otherwise An instance of ::rb_cString. @post ARGF is read. @post $_ is set.

@internal

In reality, this function can call ARGF.gets. Its redefinition can affect the behaviour.

Also, you can tamper ARGV on-the-fly in middle of ARGF usages:

gets                        # Reads the first file.
ARGV << '/proc/self/limits' # Adds a file.
gets                        # Can read from /proc/self/limits.

Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.2.3