End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
IO#to_i
ios.to_i → integer
io.c
View on GitHub ↗
static VALUE
rb_io_fileno(VALUE io)
{
rb_io_t *fptr = RFILE(io)->fptr;
int fd;
rb_io_check_closed(fptr);
fd = fptr->fd;
return INT2FIX(fd);
}
Alias of #fileno
Returns an integer representing the numeric file descriptor for ios.
Example
$stdin.fileno #=> 0 $stdout.fileno #=> 1