Method: File::Stat#file?

Defined in:
file.c

#file?Boolean

Returns true if stat is a regular file (not a device file, pipe, socket, etc.).

File.stat("testfile").file?   #=> true

Returns:

  • (Boolean)


6180
6181
6182
6183
6184
6185
# File 'file.c', line 6180

static VALUE
rb_stat_f(VALUE obj)
{
    if (S_ISREG(get_stat(obj)->st_mode)) return Qtrue;
    return Qfalse;
}