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
file.c
View on GitHub ↗
static VALUE
rb_stat_S(VALUE obj)
{
#ifdef S_ISSOCK
if (S_ISSOCK(get_stat(obj)->st_mode)) return Qtrue;
#endif
return Qfalse;
}
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