Skip to content

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

instance method

File::Stat#socket?

stat.socket? → true or false

Returns true if stat is a socket, false if it isn’t or if the operating system doesn’t support this feature.

Example
File.stat("testfile").socket?   #=> false
See also #size? #sticky? #size #symlink? also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0