Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
File::Stat#directory?
() -> bool
directory? → true or false
file.c
View on GitHub ↗
static VALUE
rb_stat_d(VALUE obj)
{
if (S_ISDIR(get_stat(obj)->ST_(mode))) return Qtrue;
return Qfalse;
}
Returns whether the entry in the snapshot in self is a directory:
Example
File.stat('/etc').directory? # => true File.stat('/etc/passwd').directory? # => false
See also
#dev_minor
#executable?
#dev_major
#executable_real?
also in
4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0