Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
File::Stat#ftype
() -> ::String
stat.ftype → string
file.c
View on GitHub ↗
static VALUE
rb_stat_ftype(VALUE obj)
{
return rb_file_ftype(get_stat(obj));
}
Identifies the type of stat. The return string is one of: “file”, “directory”, “characterSpecial”, “blockSpecial”, “fifo”, “link”, “socket”, or “unknown”.
Example
File.stat("/dev/tty").ftype #=> "characterSpecial"