Skip to content

End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

Dir#fileno

dir.fileno → integer

Returns the file descriptor used in dir.

Example
d = Dir.new("..")
d.fileno   #=> 8

This method uses dirfd() function defined by POSIX 2008. NotImplementedError is raised on other platforms, such as Windows, which doesn’t provide the function.

See also #each_child #inspect #each #path also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.0